303875: CF747B. Mammoth's Genome Decoding

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Mammoth's Genome Decoding

题意翻译

# 题目描述 给定长度为 n 且只含有 A、T、C、G和? 的字符串s,其中?可以转换为任何一个字母,问是否存在一个字符串,使得将所有的?替换成字母后,A、T、C、G个数相等。 # 输入格式 两行 第一行,一个整数n(4<=n<=255),表示字符串的长度 第二行,一个字符串s # 输出格式 一行,表示将所有的?替换成字母后使得A、T、C、G个数相等的字符串,若不存在输出“===”(不含引号)。

题目描述

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.

输入输出格式

输入格式


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 '?'.

输出格式


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.

Input

题意翻译

# 题目描述 给定长度为 n 且只含有 A、T、C、G和? 的字符串s,其中?可以转换为任何一个字母,问是否存在一个字符串,使得将所有的?替换成字母后,A、T、C、G个数相等。 # 输入格式 两行 第一行,一个整数n(4<=n<=255),表示字符串的长度 第二行,一个字符串s # 输出格式 一行,表示将所有的?替换成字母后使得A、T、C、G个数相等的字符串,若不存在输出“===”(不含引号)。

加入题单

上一题 下一题 算法标签: