AtCoder Beginner Contest 122 - Double Helix

On the Planet AtCoder, there are four types of bases: A, C, G and T. A bonds with T, and C bonds with G.
You are given a letter b as input, which is A, C, G or T. Write a program that prints the letter representing the base that bonds with the base b.

-----Constraints-----
 - b is one of the letters A, C, G and T.

-----Input-----
Input is given from Standard Input in the following format:
b

-----Output-----
Print the letter representing the base that bonds with the base b.

-----Sample Input-----
A

-----Sample Output-----
T

Difficulty: EASY

Starter code:

Solutions:
print(['A', 'T', 'C', 'G'][['T', 'A', 'G', 'C'].index(input())])


b = input()
dh = {'A': 'T', 'C': 'G', 'T': 'A', 'G': 'C'}
print(dh[b])


d = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}
print(d[input()])


b = input()
if b == 'A':
	print('T')
elif b == 'C':
	print('G')
elif b == 'T':
	print('A')
elif b == 'G':
	print('C')


dna = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}
print(dna[input()])


n = input()
c = ['A', 'T', 'G', 'C']
a = ['T', 'A', 'C', 'G']
for i in range(4):
	if n == c[i]:
		print(a[i])
		break


print('TAGC'['ATCG'.find(input())])


dic = {'A': 'T', 'T': 'A', 'G': 'C', 'C': 'G'}
print(dic[input()])


n = str(input())
if n == 'A':
	print('T')
elif n == 'T':
	print('A')
elif n == 'G':
	print('C')
else:
	print('G')


x = ['A', 'C', 'G', 'T']
b = input()
print(x[3 - x.index(b)])


print('TGCA'['ACGT'.index(input())])


print('ATCG'['TAGC'.index(input())])


print('ACGT'['TGCA'.find(input())])


moji = str(input())
correct = ['A', 'C', 'G', 'T']
ind = correct.index(moji) + 1
print(correct[ind * -1])


s = input()
if s == 'A':
	print('T')
elif s == 'T':
	print('A')
elif s == 'G':
	print('C')
elif s == 'C':
	print('G')


b = input()
L = ['A', 'C', 'G', 'T']
c = L.index(b)
print(L[3 - c])


b = str(input())
if b == 'A':
	print('T')
elif b == 'T':
	print('A')
elif b == 'C':
	print('G')
else:
	print('C')


ls = {'A': 'T', 'C': 'G', 'T': 'A', 'G': 'C'}
print(ls[input()])


a = input()
print({'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}[a])


print('TGC   A'[(ord(input()) - 64) // 3])


b = input()
dict = {'A': 'T', 'C': 'G', 'G': 'C', 'T': 'A'}
print(dict[b])


s = input()
print({'A': 'T', 'T': 'A', 'G': 'C', 'C': 'G'}[s])


a = ['A', 'C', 'G', 'T']
b = input()
print(a[-1 - a.index(b)])


b = input()
dic = {i: j for (i, j) in zip('ATCG', 'TAGC')}
print(dic[b])


print({'A': 'T', 'T': 'A', 'G': 'C', 'C': 'G'}.get(input()))


print(''.join(('TGCA'['ACGT'.find(c)] for c in input())))


S = 'ACGT'
T = 'TGCA'
b = input()
print(T[S.index(b)])


print('ATACGC'['ATACGC'.find(str(input())) + 1])


base = 'ATAGCG'
print(base[base.index(input()) + 1])


s = 'ATCG'
k = s.index(input())
print(s[k ^ 1])


B = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}
b = input()
print(B[b])


def f(c):
	if c == 'A':
		return 'T'
	elif c == 'T':
		return 'A'
	elif c == 'C':
		return 'G'
	else:
		return 'C'
print(f(input()))


B = input()
print(dict(zip('ATCG', 'TAGC'))[B])


b = input()
text = 'ATCGTAGC'
print(text[text.find(b) + 4])


B = input()
print('ACGT'[-('ACGT'.index(B) + 1)])


b = input()
L = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}
print(L[b])


N = input()
S = {'A': 'T', 'C': 'G', 'T': 'A', 'G': 'C'}
print(S[N])


m = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}
print(m[input()])


print('ATGC'['TACG'.find(input())])


b = input()
c = {'A': 'T', 'T': 'A', 'G': 'C', 'C': 'G'}
print(c[b])


di = {'A': 'T', 'T': 'A', 'G': 'C', 'C': 'G'}
print(di[input()])


print('TCG A'[ord(input()) % 5])


p = 'ACGTTGCA'
print(p[p.find(input()) + 4])


b = input()
s0 = ['A', 'T', 'C', 'G']
s1 = ['T', 'A', 'G', 'C']
for (i, s) in enumerate(s0):
	if s == b:
		print(s1[i])
		break


a = 'ACGT'
print(a[3 - a.index(input())])


c = input()
print('ATGC'[(c == 'A') + (c == 'G') * 3 + (c == 'C') * 2])


p = {'A': 'T', 'T': 'A', 'G': 'C', 'C': 'G'}
print(p[input()])


B = input()
W = 'TACG'
N = 'ATGC'.find(B)
print(W[N])


s = ['A', 'T', 'C', 'G']
print(s['TAGC'.find(input())])


b = str(input())

def main():
	if b == 'A':
		print('T')
	elif b == 'T':
		print('A')
	elif b == 'C':
		print('G')
	elif b == 'G':
		print('C')

def __starting_point():
	main()
__starting_point()


n = input()
print({'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}[n])


b = 'ATAGCG'
print(b[1 + b.index(input())])


b = input()
if b == 'A':
	ans = 'T'
elif b == 'T':
	ans = 'A'
elif b == 'C':
	ans = 'G'
else:
	ans = 'C'
print(ans)


s = 'ATACGC'
print(s[s.index(input()) + 1])


b = input()
e = {'A': 'T', 'C': 'G', 'G': 'C', 'T': 'A'}
print(e[b])


l = ['A', 'C', 'G', 'T']
print(l[3 - l.index(input())])


ans = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}
print(ans[input()])


l = ['A', 'C', 'T', 'G']
b = input()
print(l[l.index(b) - 2])


b = input()
x = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}
print(x[b])


bmap = {'A': 'T', 'T': 'A', 'G': 'C', 'C': 'G'}
print(bmap[input()])


a = ['A', 'C', 'G', 'T']
b = ['T', 'G', 'C', 'A']
asn = ''
s = str(input())
for i in range(4):
	if s == a[i]:
		print(b[i])


b = input()
print('A' if b == 'T' else 'T' if b == 'A' else 'G' if b == 'C' else 'C')


print(['A', 'T', 'C', 'G'][(ord(input()) + 1) % 5])


b = input()
l = 'AGCTTCGA'
print(l[l.find(b) + 4])


table = {'A': 'T', 'T': 'A', 'G': 'C', 'C': 'G'}
print(table[input().rstrip()])


print({'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}[str(input())[:1]])


l = {'A': 'T', 'T': 'A', 'G': 'C', 'C': 'G'}
print(l[input()])


x = input()
if x == 'A':
	print('T')
elif x == 'C':
	print('G')
elif x == 'G':
	print('C')
else:
	print('A')


l = list('ACGT')
print(l[3 - l.index(input())])


def main():
	b = input()
	if b == 'A':
		print('T')
	elif b == 'T':
		print('A')
	elif b == 'C':
		print('G')
	else:
		print('C')
main()


base = {'A': 'T', 'T': 'A', 'G': 'C', 'C': 'G'}
print(base[input()])


b = input()
L = ['A', 'C', 'G', 'T']
print(L[::-1][L.index(b)])


b = 'ATACGC'
print(b[1 + b.index(input())])


b = input()
enki = {'A': 'T', 'C': 'G', 'T': 'A', 'G': 'C'}
print(enki[b])


h = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}
print(h[input()])


n = input()
m = 'ATACGC'
print(m[m.index(n) + 1])


D = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}
print(D[input()])


a = 'ATCG'
b = 'TAGC'
print(b[a.find(input())])


s = 'ACGT'
b = input()
print(s[3 - s.find(b)])


a = 'ACGT'
b = 'TGCA'
print(b[a.index(input())])


b = input()
if b == 'A' or b == 'T':
	print('AT'.replace(b, ''))
else:
	print('CG'.replace(b, ''))


b = input()
b = b.replace('A', 'a')
b = b.replace('T', 'b')
b = b.replace('C', 'c')
b = b.replace('G', 'd')
b = b.replace('a', 'T')
b = b.replace('b', 'A')
b = b.replace('c', 'G')
b = b.replace('d', 'C')
print(b)


d = ['A', 'C', 'G', 'T']
print(d[3 - d.index(input())])


a = input()
if a == 'A':
	print('T')
elif a == 'C':
	print('G')
elif a == 'G':
	print('C')
else:
	print('A')


B = input()
X = 'ATCG'
Y = 'TAGC'
print(Y[X.index(B)])


import sys
b = input()
d = {'A': 'T', 'T': 'A', 'G': 'C', 'C': 'G'}
print(d[b])


s = 'ATACGC'
print(s[s.find(input()) + 1])


a = 'ACTG'
c = input()
print(a[(a.find(c) + 2) % 4])


print('ATCG'['ATCG'.index(input()) ^ 1])


DNA_b = input()
if DNA_b == 'A':
	print('T')
elif DNA_b == 'T':
	print('A')
elif DNA_b == 'C':
	print('G')
elif DNA_b == 'G':
	print('C')


print(input().translate(str.maketrans('ATGC', 'TACG')))


b = str(input())
E = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}
print(E[b])


b = input()
s = list('ACTG')
print(s[(s.index(b) + 2) % 4])


print(input().translate(str.maketrans('ATCG', 'TAGC')))


print(input().replace('A', 'a').replace('T', 'A').replace('a', 'T').replace('G', 'g').replace('C', 'G').replace('g', 'C'))


a = 'ACGT'
print(a[3 - a.find(input())])


bases = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}
print(bases[input()])


S = input()
E = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}
print(E[S])


S = input()
if S == 'G':
	print('C')
elif S == 'C':
	print('G')
elif S == 'A':
	print('T')
else:
	print('A')


b = input()
H = {'A': 'T', 'C': 'G', 'T': 'A', 'G': 'C'}
print(H[b])


aT = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}
print(aT[input()])


S = ' ACGT'
print(S[-1 * S.index(input())])


a = 'ACTGACT'
print(a[a.index(input()) + 2])


ds = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}
print(ds[input()])


s = 'ACTG'
print(s[s.index(input()) - 2])


a = ['A', 'G', 'T', 'C']
b = input()
print(a[a.index(b) - 2])


b = input()
d = dict(zip('ACTG', 'TGAC'))
print(d[b])


M = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}
print(M[input()])


B = input()
L1 = 'ACGT'
L2 = 'TGCA'
print(L2[L1.index(B)])


c = input()
d = 'AGTC'
for i in range(0, 4):
	if d[i] == c:
		print(d[(i + 2) % 4])


b = str(input())
basis = ['A', 'C', 'G', 'T']
label = basis.index(b)
print(basis[3 - label])


vocab = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}
print(vocab[input()])


s1 = 'ACGT'
s2 = 'TGCA'
b = input()
for i in range(4):
	if s1[i] == b:
		print(s2[i])
		break


s = 'ACGT'
print(s[3 - s.index(input())])


b = str(input())
if b == 'A':
	print('T')
if b == 'T':
	print('A')
if b == 'C':
	print('G')
if b == 'G':
	print('C')


b = input()
e = 'ACGT'
print(e[3 - e.index(b)])


lst = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}
print(lst[input()])


n = input()
ans = 'ACGT'
k = ans.index(n) ^ 3
print(ans[k])


Enki = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}
print(Enki[input()])


d = dict()
d['A'] = 'T'
d['T'] = 'A'
d['C'] = 'G'
d['G'] = 'C'
S = input()
print(d[S])


b = input()
pair = {'A': 'T', 'C': 'G', 'T': 'A', 'G': 'C'}
print(pair[b])


a = 'ATCG'
print(a['TAGC'.index(input())])


b = input()
A = 'ACGT'
B = 'TGCA'
print(B[A.index(b)])


T = 'ATCG'
print(T[T.find(input()) ^ 1])


b = input()
s = 'ACGT'
t = 'TGCA'
print(t[s.find(b)])


c = input()
if c == 'A':
	print('T')
elif c == 'T':
	print('A')
elif c == 'C':
	print('G')
else:
	print('C')


b = input()
if b == 'A' or b == 'T':
	if b == 'A':
		print('T')
	else:
		print('A')
elif b == 'C':
	print('G')
else:
	print('C')


gene = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}
print(gene[input()])


print('TA  CG'[(66 - ord(input())) // 4])


b = input()
if b == 'A':
	print('T')
elif b == 'T':
	print('A')
elif b == 'G':
	print('C')
elif b == 'C':
	print('G')
else:
	print('error')


char = input()
answer = ''
if char == 'A':
	answer = 'T'
elif char == 'C':
	answer = 'G'
elif char == 'G':
	answer = 'C'
else:
	answer = 'A'
print(answer)


j = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}
print(j[input()])