Editorial for DMOPC '18 Contest 6 P1 - DNA or RNA?


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.

Submitting an official solution before solving the problem yourself is a bannable offence.

Authors: AvaLovelace

Firstly, check if the string contains any letter that is not A, C, G, T, or U. If this is true, it is neither DNA nor RNA.

Then, check for the presence of a T and a U in the string. If only T is present, it is DNA. If only U is present, it is RNA. If neither are present, it could be either DNA or RNA. Finally, if both are present, it is neither DNA nor RNA.

Interesting fact: in reality, DNA can contain uracil and RNA can contain thymine on rare occasions.


Comments

There are no comments at the moment.