DMOPC '18 Contest 6 P1 - DNA or RNA?

View as PDF

Submit solution

Points: 3
Time limit: 2.0s
Memory limit: 64M

Problem type

Deoxyribonucleic acid (DNA) and ribonucleic acid (RNA) are both molecules used for storing genetic code, and both consist of a number of bases connected in a line. A DNA or RNA molecule can be represented as a string of uppercase English letters, each letter representing a base.

Each base in a DNA or RNA molecule must be one of the following: adenine (A), cytosine (C), guanine (G), thymine (T), or uracil (U). Thymine is found only in DNA, while uracil is found only in RNA. Adenine, cytosine, and guanine can be present in both DNA and RNA.

Dr. Henri is studying a molecule consisting of N bases. He wants to know if it could be DNA, RNA, or something completely new!


1 \le N \le 1\ 000\ 000

Input Specification

Two lines.
The first line contains N.
The second line contains N characters with no spaces, representing the bases of the molecule. All of the characters are uppercase English letters.

Output Specification

Output DNA if the molecule could be DNA only, RNA if it could be RNA only, both if it could be either, and neither if it could not be RNA or DNA.

Sample Input 1


Sample Output 1


Sample Input 2


Sample Output 2


Sample Input 3


Sample Output 3



There are no comments at the moment.