Restriction Site Palindrome Checker

Intermediate Bioinformatics Restriction Enzyme Palindrome Reverse Complement
Significance:

Most type-II restriction enzymes recognise sites that are reverse-complement palindromes — EcoRI
cuts GAATTC, whose reverse complement is also GAATTC. That symmetry is why the enzyme's homodimer
can bind either strand identically, and recognising it is fundamental to cloning and RFLP work.

Statement

A DNA string is a reverse-complement palindrome if it is equal to its own reverse complement.
Given a DNA string, decide whether it is one.

Print YES if it is, or NO if it is not.

(The verdict is deliberately YES/NO rather than a boolean, because Python prints True
while R prints TRUE — a language-neutral token keeps the problem solvable in both.)

Input — read from standard input
Variable Type Description
s
line 1
str The candidate restriction site
1 <= len(s) <= 1000, uppercase A, C, G, T only

These variables are already read for you in the starter code on the right.

Output

str exactly YES or NO, on one line

Sample Cases
Sample 1
Input
GAATTC
Expected Output
YES
The EcoRI site — its reverse complement is also GAATTC.
Sample 2
Input
AAAA
Expected Output
NO
Reverse complement is TTTT, which differs, so NO.

Submit also runs your code against 5 hidden test cases. Hidden inputs are never shown — if one fails you'll get its number and a description of the mismatch, not the data.

Constraints
  • 1 <= length(s) <= 1000
  • Uppercase A, C, G, T only
  • Odd-length strings can never be reverse-complement palindromes
Further Reading
  • Reuse your reverse-complement routine and compare the result to the input.
  • Print the token exactly: YES or NO, uppercase, nothing else.

My Notes
Log in to save personal notes.
Console output will appear here when you click Run Code or Submit...
Expected: s (str)
Next Problem
Translating RNA into Protein