DMOPC '18 Contest 6 P1 - DNA or RNA?
View as PDFDeoxyribonucleic 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  bases. He wants to know if it could be DNA, RNA, or something completely new!
Constraints
Input Specification
The first line contains .
The second line contains  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
6
ACTAGC
Sample Output 1
DNA
Sample Input 2
6
GCAAGG
Sample Output 2
both
Sample Input 3
6
NLOPEJ
Sample Output 3
neither
Comments