CF747B.Mammoth's Genome Decoding

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

The process of mammoth's genome decoding in Berland comes to its end!

One of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, s is a string consisting of letters 'A', 'C', 'G', 'T' and characters '?'.

It is known that the number of nucleotides of each of the four types in the decoded genome of mammoth in Berland should be equal.

Your task is to decode the genome and replace each unrecognized nucleotide with one of the four types so that the number of nucleotides of each of the four types becomes equal.

猛犸象基因组在贝尔兰的解码工作即将完成!

剩下的少数任务之一是恢复已发现序列 $ s $ 中未识别的核苷酸。每个核苷酸用一个英文字母大写表示:'A'、'C'、'G' 或 'T'。未识别的核苷酸用问号 '?' 表示。因此,$ s $ 是一个由字母 'A'、'C'、'G'、'T' 和字符 '?' 组成的字符串。

已知:贝尔兰所解码的猛犸象基因组中,四种核苷酸的数量应当相等。

你的任务是对该基因组进行解码,将每个未识别的核苷酸(即每个 '?')替换为四种类型之一,使得最终四种核苷酸的数量完全相等。

输入格式

The first line contains the integer n (4 ≤ n ≤ 255) — the length of the genome.

The second line contains the string s of length n — the coded genome. It consists of characters 'A', 'C', 'G', 'T' and '?'.

第一行包含一个整数 nn(4≤n≤2554 \leq n \leq 255)——基因组的长度。

第二行包含一个长度为 nn 的字符串 ss —— 编码后的基因组。该字符串由字符 'A'、'C'、'G'、'T' 和 '?' 组成。

输出格式

If it is possible to decode the genome, print it. If there are multiple answer, print any of them. If it is not possible, print three equals signs in a row: "===" (without quotes).

如果可以解码该基因组,则输出解码后的结果;如果存在多个可行答案,输出其中任意一个即可;如果无法解码,则输出三个等号:\===(不带引号)。

输入输出样例

  • 输入#1

    8
    AG?C??CT

    输出#1

    AGACGTCT
  • 输入#2

    4
    AGCT

    输出#2

    AGCT
  • 输入#3

    6
    ????G?

    输出#3

    ===
  • 输入#4

    4
    AA??

    输出#4

    ===

说明/提示

In the first example you can replace the first question mark with the letter 'A', the second question mark with the letter 'G', the third question mark with the letter 'T', then each nucleotide in the genome would be presented twice.

In the second example the genome is already decoded correctly and each nucleotide is exactly once in it.

In the third and the fourth examples it is impossible to decode the genom.

在第一个例子中,你可以将第一个问号替换为字母 'A',第二个问号替换为字母 'G',第三个问号替换为字母 'T',这样基因组中的每个核苷酸都将恰好出现两次。

在第二个例子中,基因组已经正确解码,且每个核苷酸在其中恰好出现一次。

在第三个和第四个例子中,无法对基因组进行解码。

输入解题思路,AI测评打分。不知道怎么写?

首页