# Problem

Create a function that can determine whether or not an arbitrary DNA string is a Watson-Crick palindrome. The function will take a DNA string and output a true value if the string is a Watson-Crick palindrome and a false value if it is not. (True and False can also be represented as 1 and 0, respectively.)

The DNA string may either be in all uppercase or all lowercase depending on your preference.

Also, the DNA string will not be empty.

# Explanation

A DNA string is a Watson-Crick palindrome when the complement of its reverse is equal to itself.

Given a DNA string, first reverse it, and then complement each character according to the DNA bases (A ↔ T and C ↔ G). If the original string is equal to the complemented-reverse string, it is a Watson-Crick palindrome.

For more, see this question. It is a different challenge where you must find the longest substring of a DNA string where that substring is a Watson-Crick palindrome.

# Goal

This is code-golf and the shortest code wins.

# Test Cases

The format is <input> = <output>.

ATCGCGAT = true
AGT = false
GTGACGTCAC = true
GCAGTGA = false
GCGC = true
AACTGCGTTTAC = false
ACTG = false

• Related. – Martin Ender Apr 25 '16 at 6:39
• Someone should write a program in DNA# that is also a Watson-Crick palindrome. :D (might not be possible) – mbomb007 Apr 25 '16 at 16:49
• Or, if you like, "a word is a Watson–Crick palindrome if it has order 2 in the free group on 2 generators" (or on n generators!). – wchargin Apr 26 '16 at 3:19
• (I guess technically that's "order at most 2.") – wchargin Apr 26 '16 at 3:19
• @AndrasDeak According to Watsons book, Franklin was apparently mostly a thorn in their side. She repeatedly refused to hand over x-rays showing the helix (as I recall), because she refused to believe it. Its worth a read if you are interested in the discovery at any rate. – Obsidian Phoenix Apr 27 '16 at 15:19

# J, 19 bytes

|.-:-&.('+AGCT'i.])


Try it online!

# Wolfram Language (Mathematica), 45 bytes

17-#==Reverse@#&@Mod[ToCharacterCode@#,11,2]&


Try it online!

Converts A to 10, T to 7, C to 12, and G to 5, by taking the ASCII codes mod 11 with offset 2. Then checks if the resulting list and its reverse add to 17 in each coordinate.