Jadoo and DNA Transcription.

 Problem:-

Jadoo, the Space Alien has befriended Koba upon landing on Earth. Since then, he wishes Koba to be more like him. In order to do so he decides to slowly transcribe Koba’s DNA into RNA. But he has to write a very short code in order to do the transcription so as not to make Koba aware of the change.

The four nucleotides found in DNA are adenine (A), cytosine (C), guanine (G) and thymine (T).

The four nucleotides found in RNA are adenine (A), cytosine (C), guanine (G) and uracil (U).

Given a DNA strand, its transcribed RNA strand is formed by replacing each nucleotide with its complement:

  • G --> C
  • C --> G
  • T --> A
  • A --> U

     

    Input: The input will always be a string of characters.

    Output: The output should always be a string of characters. In the case of invalid input, you should output Invalid Input as a string.

            Rules: Your code should not consist of any numerical characters             (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) and the length of your code should be             <= 103. If your code consists of numerical characters, then your             score is zero irrespectuve of your code length or testcases             satisfied. If your code is devoid of numerical characters and is of             length > 103 then you score 50%.

SAMPLE INPUT
 
C
SAMPLE OUTPUT
 
G
Time Limit:5.0 sec(s) for each input file.
Memory Limit:256 MB
Source Limit:1024 KB

Solution:-

string=input()
flag=‘a’
st=[]
for i in string:
if i==‘A’ :
st.append(‘U’)
elif i==‘G’:
st.append(‘C’)
elif i==‘C’:
st.append(‘G’)
elif i==‘T’:
st.append(‘A’)
else:
print(“Invalid Input”)
flag=‘b’
break
if flag==‘a’:
for j in st:
print(j,end=“”)


Leave a Reply

Your email address will not be published.