For encoding an even-length binary string into a sequence of A, T, C, and G, we iterate from left to right and replace the characters as follows:
00 is replaced with A
01 is replaced with T
10 is replaced with C
11 is replaced with G

Given a binary string S of length N (N is even), find the encoded sequence.

------ Input Format ------ 

- First line will contain T, number of test cases. Then the test cases follow.
- Each test case contains two lines of input.
- First line contains a single integer N, the length of the sequence.
- Second line contains binary string S of length N.

------ Output Format ------ 

For each test case, output in a single line the encoded sequence.

Note: Output is case-sensitive.

------ Constraints ------ 

$1 ≤ T ≤ 100$
$2 ≤ N ≤ 10^{3}$
$N$ is even.
- Sum of $N$ over all test cases is at most $10^{3}$.
$S$ contains only characters 0 and 1.

----- Sample Input 1 ------ 
4
2
00
4
0011
6
101010
4
1001

----- Sample Output 1 ------ 
A
AG
CCC
CT
----- explanation 1 ------ 
Test case $1$: Based on the rules 00 is replaced with A.

Test case $2$: Based on the rules 00 is replaced with A. Similarly, 11 is replaced with G. Thus, the encoded sequence is AG.

Test case $3$: The first two characters are 10 which is encoded as C. Similarly, the next two characters 10 are encoded as C and the last two characters 10 are encoded as C. Thus, the encoded string is CCC.

Test case $4$: The first two characters are 10 which is encoded as C. Similarly, the next two characters 01 are encoded as T. Thus, the encoded string is CT.

Difficulty: EASY
Tags: Implementation

Starter code:

Solutions:
for i in range(int(input())):
	n = int(input())
	s = input()
	a = ''
	for k in range(0, n - 1, 2):
		if s[k] + s[k + 1] == '00':
			a += 'A'
		elif s[k] + s[k + 1] == '01':
			a += 'T'
		elif s[k] + s[k + 1] == '10':
			a += 'C'
		elif s[k] + s[k + 1] == '11':
			a += 'G'
	print(a)


for i in range(int(input())):
	n = int(input())
	s = str(input())
	p = ''
	for i in range(0, n, 2):
		if s[i] + s[i + 1] == '00':
			p += 'A'
		elif s[i] + s[i + 1] == '01':
			p += 'T'
		elif s[i] + s[i + 1] == '10':
			p += 'C'
		elif s[i] + s[i + 1] == '11':
			p += 'G'
		else:
			continue
	print(p)


for _ in range(int(input())):
	En = {'00': 'A', '01': 'T', '10': 'C', '11': 'G'}
	N = int(input())
	S = input()
	encoding = ''
	for i in range(0, N, 2):
		encoding += En[S[i:i + 2]]
	print(encoding)


n = int(input())
for i in range(1, n + 1):
	a = int(input())
	z = ''
	h = str(input())
	for j in range(0, a, 2):
		if h[j] + h[j + 1] == '00':
			z = z + 'A'
		elif h[j] + h[j + 1] == '01':
			z = z + 'T'
		elif h[j] + h[j + 1] == '10':
			z = z + 'C'
		else:
			z = z + 'G'
	print(z)


for i in range(int(input())):
	n = int(input())
	s = input()
	l = []
	d = {'00': 'A', '01': 'T', '10': 'C', '11': 'G'}
	for i in range(0, n, 2):
		l.append(d[s[i:i + 2]])
	print(''.join(l))


for i in range(int(input())):
	a = int(input())
	b = input()
	j = ''
	for i in range(len(b) - 1):
		if b[i] == '0':
			if b[i + 1] == '0':
				j += 'A'
			else:
				j += 'T'
		if b[i] == '1':
			if b[i + 1] == '0':
				j += 'C'
			else:
				j += 'G'
	l = ''
	for i in range(len(j)):
		if i % 2 == 0:
			l += j[i]
		else:
			pass
	print(l)


for i in range(int(input())):
	n = int(input())
	s = str(input())
	r = ''
	for i in range(0, n, 2):
		if s[i:i + 2] == '00':
			r += 'A'
		if s[i:i + 2] == '01':
			r += 'T'
		if s[i:i + 2] == '10':
			r += 'C'
		if s[i:i + 2] == '11':
			r += 'G'
	print(r)


for _ in range(int(input())):
	n = int(input())
	b = input()
	s = ''
	for i in range(0, n, 2):
		if b[i] + b[i + 1] == '00':
			s = s + 'A'
		elif b[i] + b[i + 1] == '01':
			s = s + 'T'
		elif b[i] + b[i + 1] == '10':
			s = s + 'C'
		else:
			s = s + 'G'
	print(s)


def encode_sequence(S):
	encoded = ''
	for i in range(0, len(S), 2):
		pair = S[i:i + 2]
		if pair == '00':
			encoded += 'A'
		elif pair == '01':
			encoded += 'T'
		elif pair == '10':
			encoded += 'C'
		elif pair == '11':
			encoded += 'G'
	return encoded
t = int(input())
for _ in range(t):
	n = int(input())
	s = input().strip()
	result = encode_sequence(s)
	print(result)


for _ in range(int(input())):
	n = int(input())
	s = input()
	r = ''
	for i in range(0, n, 2):
		if s[i] + s[i + 1] == '00':
			r += 'A'
		elif s[i] + s[i + 1] == '11':
			r += 'G'
		elif s[i] + s[i + 1] == '10':
			r += 'C'
		elif s[i] + s[i + 1] == '01':
			r += 'T'
	print(r)


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	a = 0
	b = 1
	res = ''
	rang = n // 2
	for i in range(rang):
		if s[a] == '0' and s[b] == '0':
			res = res + 'A'
			a += 2
			b += 2
		elif s[a] == '0' and s[b] == '1':
			res = res + 'T'
			a += 2
			b += 2
		elif s[a] == '1' and s[b] == '0':
			res = res + 'C'
			a += 2
			b += 2
		elif s[a] == '1' and s[b] == '1':
			res = res + 'G'
			a += 2
			b += 2
	print(res)


t = int(input())
for i in range(t):
	n = int(input())
	s = str(input())
	a = ''
	for j in range(0, n, 2):
		if s[j:j + 2] == '00':
			a += 'A'
		if s[j:j + 2] == '01':
			a += 'T'
		if s[j:j + 2] == '10':
			a += 'C'
		if s[j:j + 2] == '11':
			a += 'G'
	print(a)


for _ in range(int(input())):
	x = int(input())
	n = str(input())
	a = ''
	for i in range(0, x, 2):
		if n[i] + n[i + 1] == '00':
			a = a + 'A'
		elif n[i] + n[i + 1] == '01':
			a = a + 'T'
		elif n[i] + n[i + 1] == '10':
			a = a + 'C'
		else:
			a = a + 'G'
	print(a)


t = int(input())
for i in range(t):
	n = int(input())
	s = str(input())
	newstring = ''
	for i in range(0, n, 2):
		if s[i] == '0' and s[i + 1] == '0':
			newstring = newstring + 'A'
		elif s[i] == '0' and s[i + 1] == '1':
			newstring = newstring + 'T'
		elif s[i] == '1' and s[i + 1] == '0':
			newstring = newstring + 'C'
		else:
			newstring = newstring + 'G'
	print(newstring)


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	for i in range(0, n - 1, 2):
		if s[i:i + 2] == '00':
			print('A', end='')
		elif s[i:i + 2] == '01':
			print('T', end='')
		elif s[i:i + 2] == '10':
			print('C', end='')
		else:
			print('G', end='')
	print()


T = int(input())
for i in range(T):
	p = ''
	N = int(input())
	S = input()
	for j in range(0, N, 2):
		if S[j] + S[j + 1] == '00':
			p = p + 'A'
		elif S[j] + S[j + 1] == '01':
			p = p + 'T'
		elif S[j] + S[j + 1] == '10':
			p = p + 'C'
		elif S[j] + S[j + 1] == '11':
			p = p + 'G'
	print(p)


for j in range(int(input())):
	n = int(input())
	s = input()
	lst = []
	i = 0
	while i < len(s):
		a = s[i] + s[i + 1]
		lst.append(a)
		i += 2
	a = ''
	for i in lst:
		if i == '00':
			a += 'A'
		elif i == '01':
			a += 'T'
		elif i == '10':
			a += 'C'
		elif i == '11':
			a += 'G'
		else:
			pass
	print(a)


for t in range(int(input())):
	n = int(input())
	s = str(input())
	z = ''
	for i in range(0, n, 2):
		if s[i] + s[i + 1] == '00':
			z += 'A'
		elif s[i] + s[i + 1] == '01':
			z += 'T'
		elif s[i] + s[i + 1] == '10':
			z += 'C'
		elif s[i] + s[i + 1] == '11':
			z += 'G'
	print(z)


for i in range(int(input())):
	n = int(input())
	string = input()
	result = ''
	for i in range(0, n, 2):
		if string[i] + string[i + 1] == '00':
			result = result + 'A'
		elif string[i] + string[i + 1] == '01':
			result = result + 'T'
		elif string[i] + string[i + 1] == '10':
			result = result + 'C'
		elif string[i] + string[i + 1] == '11':
			result = result + 'G'
	print(result)


for _ in range(int(input())):
	n = int(input())
	s = input()
	z = ''
	for i in range(0, n, 2):
		if s[i] == '0' and s[i + 1] == '0':
			z += 'A'
		elif s[i] == '0' and s[i + 1] == '1':
			z += 'T'
		elif s[i] == '1' and s[i + 1] == '0':
			z += 'C'
		elif s[i] == '1' and s[i + 1] == '1':
			z += 'G'
	print(z)


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	r = ''
	for j in range(0, n, 2):
		if s[j:j + 2] == '00':
			r += 'A'
		elif s[j:j + 2] == '01':
			r += 'T'
		elif s[j:j + 2] == '10':
			r += 'C'
		else:
			r += 'G'
	print(r)


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	dna = ''
	for i in range(0, n, 2):
		if s[i:i + 2] == '00':
			dna += 'A'
		elif s[i:i + 2] == '01':
			dna += 'T'
		elif s[i:i + 2] == '10':
			dna += 'C'
		else:
			dna += 'G'
	print(dna)


T = int(input())
for i in range(T):
	N = int(input())
	S = input()
	for i in range(0, N, 2):
		if S[i] + S[i + 1] == '00':
			print('A', end='')
		elif S[i] + S[i + 1] == '01':
			print('T', end='')
		elif S[i] + S[i + 1] == '10':
			print('C', end='')
		else:
			print('G', end='')
	print()


t = int(input())
for i in range(t):
	x = int(input())
	y = input()
	for i in range(0, x, 2):
		if y[i] + y[i + 1] == '00':
			print('A', end='')
		elif y[i] + y[i + 1] == '01':
			print('T', end='')
		elif y[i] + y[i + 1] == '10':
			print('C', end='')
		else:
			print('G', end='')
	print()


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	x = ''
	for i in range(0, n - 1, 2):
		if s[i] + s[i + 1] == '00':
			x += 'A'
		if s[i] + s[i + 1] == '01':
			x += 'T'
		if s[i] + s[i + 1] == '10':
			x += 'C'
		if s[i] + s[i + 1] == '11':
			x += 'G'
	print(x)


t = int(input())
for i in range(0, t):
	n = int(input())
	s = input()
	dict = {'00': 'A', '01': 'T', '10': 'C', '11': 'G'}
	temp = ''
	answer = ''
	for i in range(0, n, 2):
		temp = s[i] + s[i + 1]
		answer += dict[temp]
	print(answer)


for _ in range(int(input())):
	a = int(input())
	l = input()
	ans = ''
	for i in range(0, a, 2):
		if l[i:i + 2] == '00':
			ans += 'A'
		elif l[i:i + 2] == '01':
			ans += 'T'
		elif l[i:i + 2] == '10':
			ans += 'C'
		else:
			ans += 'G'
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	out = ''
	for i in range(0, len(s), 2):
		a = s[i:i + 2]
		if a == '00':
			out += 'A'
		elif a == '01':
			out += 'T'
		elif a == '10':
			out += 'C'
		elif a == '11':
			out += 'G'
	print(out)


t = int(input())
for i in range(t):
	str1 = ''
	t2 = int(input())
	t3 = input()
	for j in range(0, t2, 2):
		if t3[j] + t3[j + 1] == '00':
			str1 += 'A'
		elif t3[j] + t3[j + 1] == '01':
			str1 += 'T'
		elif t3[j] + t3[j + 1] == '10':
			str1 += 'C'
		else:
			str1 += 'G'
	print(str1)


t = int(input())
for _ in range(t):
	n = int(input())
	s = str(input())
	res = ''
	for i in range(0, n, 2):
		if s[i:i + 2] == '00':
			res += 'A'
		if s[i:i + 2] == '01':
			res += 'T'
		if s[i:i + 2] == '10':
			res += 'C'
		if s[i:i + 2] == '11':
			res += 'G'
	print(res)


T = int(input())
for i in range(T):
	N = int(input())
	S = input()
	for i in range(0, N, 2):
		if S[i] == '0' and S[i + 1] == '0':
			print('A', end='')
		elif S[i] == '0' and S[i + 1] == '1':
			print('T', end='')
		elif S[i] == '1' and S[i + 1] == '0':
			print('C', end='')
		elif S[i] == '1' and S[i + 1] == '1':
			print('G', end='')
	print()


for _ in range(int(input())):
	a = int(input())
	b = input()
	z = ''
	for i in range(0, a, 2):
		if b[i:i + 2] == '00':
			z += 'A'
		elif b[i:i + 2] == '01':
			z += 'T'
		elif b[i:i + 2] == '10':
			z += 'C'
		else:
			z += 'G'
	print(z)


T = int(input())
for _ in range(T):
	N = int(input())
	S = input()[0:N]
	new_str = ''
	substr = ''
	i = 0
	count = 0
	while i < len(S) + 1:
		if count != 2:
			substr += S[i]
			i += 1
			count += 1
		elif count == 2:
			if substr == '00':
				new_str += 'A'
			elif substr == '01':
				new_str += 'T'
			elif substr == '10':
				new_str += 'C'
			elif substr == '11':
				new_str += 'G'
			substr = ''
			count = 0
			if i == len(S):
				print(new_str)
				break


n = int(input())
p = []
for i in range(n):
	k = int(input())
	l = input()
	d = ''
	for j in range(0, len(l), 2):
		i1 = l[j]
		i2 = l[j + 1]
		s = i1 + i2
		if s == '00':
			d += 'A'
		elif s == '01':
			d += 'T'
		elif s == '10':
			d += 'C'
		else:
			d += 'G'
	p.append(d)
for i in p:
	print(i)


st = {'00': 'A', '01': 'T', '10': 'C', '11': 'G'}
for _ in range(int(input())):
	n = int(input())
	a = input()
	n = 0
	s = ''
	while n < len(a):
		s += st[a[n:n + 2]]
		n += 2
	print(s)


for i in range(int(input())):
	n = int(input())
	s = input()
	k = ''
	for i in range(int(n / 2)):
		if s[2 * i] + s[2 * i + 1] == '00':
			k = k + 'A'
		elif s[2 * i] + s[2 * i + 1] == '01':
			k = k + 'T'
		elif s[2 * i] + s[2 * i + 1] == '10':
			k = k + 'C'
		else:
			k = k + 'G'
	print(k)


for i in range(int(input())):
	a = int(input())
	b = input()
	c = ''
	for i in range(0, a, 2):
		if b[i] + b[i + 1] == '00':
			c = c + 'A'
		elif b[i] + b[i + 1] == '01':
			c = c + 'T'
		elif b[i] + b[i + 1] == '10':
			c += 'C'
		elif b[i] + b[i + 1] == '11':
			c = c + 'G'
	print(c)


mydict = {'00': 'A', '01': 'T', '10': 'C', '11': 'G'}
a = ''
T = int(input())
for tc in range(T):
	N = int(input())
	S = input()
	for i in range(0, len(S), 2):
		if i + 1 < len(S):
			print(mydict[S[i] + S[i + 1]], end=a)
	print(a)


for i in range(int(input())):
	n = int(input())
	s = input()
	l = []
	for i in s:
		l.append(i)
	str = ''
	for i in range(0, len(l), 2):
		if str.join(l[i:i + 2]) == '00':
			print('A', end='')
		if str.join(l[i:i + 2]) == '01':
			print('T', end='')
		if str.join(l[i:i + 2]) == '10':
			print('C', end='')
		if str.join(l[i:i + 2]) == '11':
			print('G', end='')
	print()


for _ in range(int(input())):
	n = int(input())
	s = input()
	my_list = [s[i:i + 2] for i in range(0, len(s), 2)]
	dna = {'00': 'A', '01': 'T', '10': 'C', '11': 'G'}
	cnt = ''
	for i in my_list:
		cnt += dna[i]
	print(cnt)


a = int(input())
b = {'00': 'A', '01': 'T', '10': 'C', '11': 'G'}
while a != 0:
	x = int(input())
	y = input()
	l = [i for i in y]
	i = 0
	while x:
		t = ''
		t = l[i]
		t += l[i + 1]
		i = i + 2
		x = x - 2
		print(b[t], end='')
	print('')
	a = a - 1


for t in range(int(input())):
	n = int(input())
	s = input()
	for i in range(0, len(s), 2):
		if s[i] == '0' and s[i + 1] == '0':
			print('A', end='')
		elif s[i] == '0' and s[i + 1] == '1':
			print('T', end='')
		elif s[i] == '1' and s[i + 1] == '0':
			print('C', end='')
		elif s[i] == '1' and s[i + 1] == '1':
			print('G', end='')
	print()


for _ in range(int(input())):
	t = int(input())
	k = input()
	ans = ''
	for i in range(1, t, 2):
		if k[i - 1] == '0' and k[i] == '0':
			ans += 'A'
		elif k[i - 1] == '0' and k[i] == '1':
			ans += 'T'
		elif k[i - 1] == '1' and k[i] == '0':
			ans += 'C'
		elif k[i - 1] == '1' and k[i] == '1':
			ans += 'G'
	print(ans)


for _ in range(int(input())):
	N = int(input())
	S = input()
	x = {'00': 'A', '01': 'T', '10': 'C', '11': 'G'}
	for j in range(0, N, 2):
		print(x[S[j] + S[j + 1]], end='')
	print()