Chef invented a modified wordle.

There is a hidden word S and a guess word T, both of length 5.

Chef defines a string M to determine the correctness of the guess word. For the i^{th} index:
If the guess at the i^{th} index is correct, the i^{th} character of M is \texttt{G}.
If the guess at the i^{th} index is wrong, the i^{th} character of M is \texttt{B}.

Given the hidden word S and guess T, determine string M.

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

- First line will contain T, number of test cases. Then the test cases follow.
- Each test case contains of two lines of input.
- First line contains the string S - the hidden word.
- Second line contains the string T - the guess word.

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

For each test case, print the value of string M.

You may print each character of the string in uppercase or lowercase (for example, the strings \texttt{BgBgB}, \texttt{BGBGB}, \texttt{bgbGB} and \texttt{bgbgb} will all be treated as identical).

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

$1 ≤ T ≤ 1000$
$|S| = |T| = 5$
$S, T$ contain uppercase english alphabets only.

----- Sample Input 1 ------ 
3
ABCDE
EDCBA
ROUND
RINGS
START
STUNT

----- Sample Output 1 ------ 
BBGBB
GBBBB
GGBBG

----- explanation 1 ------ 
Test Case $1$: Given string $S = \texttt{ABCDE}$ and $T = \texttt{EDCBA}$. The string $M$ is:
- Comparing the first indices, $\texttt{A} \neq \texttt{E}$, thus, $M[1] = \texttt{B}$.
- Comparing the second indices, $\texttt{B} \neq \texttt{D}$, thus, $M[2] = \texttt{B}$.
- Comparing the third indices, $\texttt{C} = \texttt{C}$, thus, $M[3] = \texttt{G}$.
- Comparing the fourth indices, $\texttt{D} \neq \texttt{B}$, thus, $M[4] = \texttt{B}$.
- Comparing the fifth indices, $\texttt{E} \neq \texttt{A}$, thus, $M[5] = \texttt{B}$.  
Thus, $M = \texttt{BBGBB}$.

Test Case $2$: Given string $S = \texttt{ROUND}$ and $T = \texttt{RINGS}$. The string $M$ is:
- Comparing the first indices, $\texttt{R} = \texttt{R}$, thus, $M[1] = \texttt{G}$.
- Comparing the second indices, $\texttt{O} \neq \texttt{I}$, thus, $M[2] = \texttt{B}$.
- Comparing the third indices, $\texttt{U} \neq \texttt{N}$, thus, $M[3] = \texttt{B}$.
- Comparing the fourth indices, $\texttt{N} \neq \texttt{G}$, thus, $M[4] = \texttt{B}$.
- Comparing the fifth indices, $\texttt{D} \neq \texttt{S}$, thus, $M[5] = \texttt{B}$.  
Thus, $M = \texttt{GBBBB}$.

Source: codechef | Difficulty: EASY
Tags: String algorithms

Data structures


Solutions:
def wordle(s, t):
	m = ''
	for i in range(len(s)):
		if s[i] == t[i]:
			m += 'G'
		else:
			m += 'B'
	return m
t = int(input())
for i in range(t):
	s = input().strip()
	t = input().strip()
	m = wordle(s, t)
	print(m)


for _ in range(int(input())):
	r = ''
	a = input()
	b = input()
	for i in range(5):
		if a[i] == b[i]:
			r += 'G'
		else:
			r += 'B'
	print(r)


t = int(input())
while t:
	s = input()
	s1 = input()
	for i in range(len(s)):
		if s[i] == s1[i]:
			print('G', end='')
		else:
			print('B', end='')
	print()
	t = t - 1


for i in range(int(input())):
	x = input()
	v = input()
	c = 0
	for i in x:
		if i == v[c]:
			print('G', end='')
		else:
			print('B', end='')
		c = c + 1
	print()


for i in range(int(input())):
	s = input()
	t = input()
	m = []
	for i in range(len(s)):
		if s[i] == t[i]:
			m.append('G')
		else:
			m.append('B')
	print(''.join(m))


n = int(input())
for i in range(n):
	s = input()
	p = input()
	c = 0
	o = ''
	for j in s:
		if j == p[c]:
			o += 'G'
		else:
			o += 'B'
		c += 1
	print(o)


for i in range(int(input())):
	s = input()
	t = input()
	m = ''
	for j in range(5):
		if s[j] == t[j]:
			m += 'G'
		else:
			m += 'B'
	print(m)


T = int(input())
for i in range(T):
	s = input()
	t = input()
	m = ''
	for i in range(len(s)):
		if s[i] != t[i]:
			m += 'B'
		else:
			m += 'G'
	print(m)


T = int(input())
for i in range(0, T):
	s = input()
	t = input()
	for i in range(5):
		if s[i] == t[i]:
			print('G', end='')
		else:
			print('B', end='')
	print()


for i in range(int(input())):
	x = input()
	y = input()
	z = ''
	for j in range(5):
		if x[j] == y[j]:
			z += 'G'
		else:
			z += 'B'
	print(z)


t = int(input())
for i in range(t):
	s = str(input())
	t = str(input())
	if s[1] == t[1]:
		a = 'G'
	else:
		a = 'B'
	if s[2] == t[2]:
		b = 'G'
	else:
		b = 'B'
	if s[3] == t[3]:
		c = 'G'
	else:
		c = 'B'
	if s[4] == t[4]:
		d = 'G'
	else:
		d = 'B'
	if s[0] == t[0]:
		e = 'G'
	else:
		e = 'B'
	print(e + a + b + c + d)


t = int(input())
ans = ''
for i in range(t):
	s = input()
	a = input()
	for j in range(len(s)):
		if s[j] == a[j]:
			ans += 'G'
		else:
			ans += 'B'
	print(ans)
	ans = ''


t = int(input())
while t != 0:
	T = input()
	S = input()
	M = ''
	for i in range(5):
		if S[i] == T[i]:
			M = M + 'G'
		else:
			M = M + 'B'
	print(M)
	t = t - 1


n = int(input())
for j in range(n):
	a = input()
	b = input()
	v = ''
	for i in range(len(a)):
		if a[i] == b[i]:
			v += 'G'
		else:
			v += 'B'
	print(v)


n = int(input())
for i in range(n):
	s = input()
	x = input()
	y = ''
	for i in range(len(s)):
		if s[i] == x[i]:
			y = y + 'G'
		else:
			y = y + 'B'
	print(y)


casos = int(input())
cont = 0
lista = []
while cont < casos:
	respuesta = []
	S = input()
	T = input()
	for i in range(len(S)):
		if S[i] == T[i]:
			respuesta.append('G')
		else:
			respuesta.append('B')
	wordle = ''.join(respuesta)
	lista.append(wordle)
	cont += 1
for i in range(len(lista)):
	print(lista[i])


ans = ''
for i in range(int(input())):
	a = input()
	b = input()
	for j in range(len(a)):
		if a[j] == b[j]:
			ans += 'G'
		else:
			ans += 'B'
	print(ans)
	ans = ''


for i in range(int(input())):
	s1 = str(input())
	s2 = str(input())
	stotal = ''
	for i in range(len(s1)):
		if s1[i] == s2[i]:
			stotal += 'G'
		else:
			stotal += 'B'
	print(stotal)


for _ in range(int(input())):
	s = list(input())
	t = list(input())
	for i in range(len(s)):
		if s[i] == t[i]:
			print('G', end='')
		else:
			print('B', end='')
	print()


for i in range(int(input())):
	n = input()
	k = input()
	s = ''
	if len(k) == len(n):
		for i in range(len(k)):
			if n[i] == k[i]:
				s += 'G'
			else:
				s += 'B'
	print(s)


def main():
	t = input()
	for i in range(int(t)):
		str1 = input()
		str2 = input()
		final = ''
		for j in range(len(str1)):
			if str1[j] == str2[j]:
				final = final + 'G'
			else:
				final = final + 'B'
		print(final)
main()


def Wordle(s: str, t: str) -> str:
	n = 5
	i = 0
	l = ''
	while n:
		if s[i].lower() == t[i].lower():
			l = l + 'G'
		else:
			l = l + 'B'
		n = n - 1
		i = i + 1
	print(l)
for i in range(int(input())):
	s = input()[:5]
	t = input()[:5]
	Wordle(s, t)


t = int(input())
for i in range(t):
	s = input()
	t = input()
	M = ''
	if len(s) == 5 and len(t) == 5:
		for j in range(len(s)):
			if s[j] == t[j]:
				M += 'G'
			else:
				M += 'B'
		print(M)


t = int(input())
while t != 0:
	s = input()
	T = input()
	m = ''
	for i in range(5):
		if s[i] == T[i]:
			m = m + 'G'
		else:
			m = m + 'B'
	print(m)
	t -= 1


t = int(input())
for i in range(t):
	h = input()
	g = input()
	m = ''
	for i in range(len(h)):
		if h[i] == g[i]:
			m = m + 'G'
		else:
			m = m + 'B'
	print(m)


for i in range(int(input())):
	s1 = input()
	s2 = input()
	s = ''
	c = 0
	while c < 5:
		if s1[c] == s2[c]:
			s += 'G'
			c += 1
		else:
			s += 'B'
			c += 1
	print(s)


for i in range(int(input())):
	a = input()
	b = input()
	m = ''
	for i in range(len(a)):
		if a[i] == b[i]:
			m = m + 'G'
		else:
			m = m + 'B'
	print(m)


for _ in range(int(input())):
	s = input()
	t = input()
	res = ''
	for i in range(len(s)):
		if s[i] == t[i]:
			res += 'G'
		else:
			res += 'B'
	print(res)


for i in range(int(input())):
	N = str(input())
	T = str(input())
	res = ''
	for j in range(5):
		if N[j:j + 1] == T[j:j + 1]:
			res += 'G'
		else:
			res += 'B'
	print(res)


for i in range(int(input())):
	N = str(input())
	T = str(input())
	result = ''
	for _ in range(5):
		if N[_:_ + 1] == T[_:_ + 1]:
			result += 'G'
		else:
			result += 'B'
	print(result)


t = int(input())
for i in range(t):
	guess = ''
	a = input()
	b = input()
	for j in range(len(a)):
		if a[j] == b[j]:
			guess += 'G'
		else:
			guess += 'B'
	print(guess)


T = int(input())
for i in range(T):
	S = input()
	T = input()
	M = ''
	for j in range(5):
		if S[j] == T[j]:
			M += 'G'
		else:
			M += 'B'
	print(M)


t = int(input())
ams = ''
for i in range(t):
	s = list(input())
	t = list(input())
	for j in range(len(s)):
		if s[j] == t[j]:
			ams += 'G'
		else:
			ams += 'B'
	print(ams)
	ams = ''


for i in range(int(input())):
	a = ''
	s = list(input())
	t = list(input())
	for j in range(0, len(t)):
		if s[j] == t[j]:
			a += 'G'
		else:
			a += 'B'
	print(a)


for i in range(int(input())):
	s = input()
	t = input()
	m = []
	for i in range(5):
		if s[i] == t[i]:
			m.append('G')
		else:
			m.append('B')
	n = ''
	print(n.join(m))


for _ in range(int(input())):
	S = input()
	t = input()
	sol = ''
	for i in range(5):
		if S[i] == t[i]:
			sol = sol + 'G'
		else:
			sol = sol + 'B'
	print(sol)


n = int(input())
for i in range(n):
	s1 = input()
	s2 = input()
	m = ''
	for j in range(5):
		if s1[j] == s2[j]:
			m = m + 'G'
		else:
			m = m + 'B'
	print(m)


t = int(input())
for i in range(t):
	s = input()
	t = input()
	M = ''
	for i in range(len(s)):
		if s[i] == t[i]:
			M += 'G'
		else:
			M += 'B'
	print(M)


t = int(input())
while t > 0:
	s = ''
	a = str(input())[:5]
	b = str(input())[:5]
	for i in range(5):
		if a[i] == b[i]:
			s = s + 'G'
		else:
			s = s + 'B'
	print(s)
	t = t - 1


for t in range(int(input())):
	S = list(input())
	T = list(input())
	m = ''
	for i in range(len(S)):
		if S[i] == T[i]:
			m += 'G'
		else:
			m += 'B'
	print(m)


for i in range(int(input())):
	st1 = input()
	st2 = input()
	st3 = ''
	for k in range(5):
		if st1[k] != st2[k]:
			st3 = st3 + 'B'
		else:
			st3 = st3 + 'G'
	print(st3)


def get_wordle(s, t):
	m = ''
	for i in range(len(s)):
		if s[i] == t[i]:
			m += 'G'
		else:
			m += 'B'
	return m
t = int(input())
for _ in range(t):
	s = input()
	t = input()
	m = get_wordle(s, t)
	print(m)


for i in range(int(input())):
	a = input()
	b = input()
	c = []
	d = []
	e = ''
	for i in a:
		c.append(i)
	for i in b:
		d.append(i)
	for i in range(5):
		if a[i] == b[i]:
			e = e + 'G'
		else:
			e = e + 'B'
	print(e)


t = int(input())
for i in range(t):
	s = str(input())
	t = str(input())
	final = ''
	for i in range(len(s)):
		if s[i] == t[i]:
			final = final + 'G'
		else:
			final = final + 'B'
	print(final)


t = int(input())
for i in range(t):
	s = input()
	s1 = list(s)
	m = input()
	m1 = list(m)
	for i in range(len(m1)):
		if m1[i] in s1[i]:
			m1.pop(i)
			m1.insert(i, 'G')
		else:
			m1.pop(i)
			m1.insert(i, 'B')
	s3 = ''
	for i in m1:
		s3 = s3 + i
	print(s3)


for _ in range(int(input())):
	ans = ''
	S = list(input())
	T = list(input())
	for i in range(0, len(S)):
		if S[i] == T[i]:
			ans += 'G'
		else:
			ans += 'B'
	print(ans)


t = int(input())
for _ in range(t):
	S = str(input())
	T = str(input())
	list1 = []
	for i in range(1, len(S) + 1):
		if S[i - 1:i] == T[i - 1:i]:
			list1.append('G')
		else:
			list1.append('B')
	str1 = ''.join(list1)
	print(str1)


for _ in range(int(input())):
	str_1 = input()
	str_2 = input()
	str_ans = ''
	for i in range(len(str_2)):
		if str_1[i] == str_2[i]:
			str_ans = str_ans + 'G'
		else:
			str_ans = str_ans + 'B'
	print(str_ans)


t = int(input())
for i in range(t):
	s = input()
	t = input()
	ans = 'BBBBB'
	for j in range(5):
		if s[j] == t[j]:
			ans = ans[:j] + 'G' + ans[j + 1:]
	print(ans)


for i in range(int(input())):
	s = list(input())
	t = list(input())
	a = ''
	for j in range(5):
		if s[j] == t[j]:
			a += 'G'
		else:
			a += 'B'
	print(a)


t = int(input())
for _ in range(t):
	a = input()
	b = input()
	c = ''
	for i in range(len(a)):
		if a[i] == b[i]:
			c += 'G'
		else:
			c += 'B'
	print(c)


t = int(input())
for _ in range(t):
	s = input().strip()
	t = input().strip()
	m = ''
	for i in range(len(s)):
		if s[i] == t[i]:
			m += 'G'
		else:
			m += 'B'
	print(m)


t = int(input())
for i in range(t):
	S = input()
	T = input()
	c = ''
	for i in range(len(S)):
		if S[i] == T[i]:
			c = c + 'G'
		else:
			c = c + 'B'
	print(c)


T = int(input())
for i in range(T):
	S = input()
	T = input()
	M = ''
	for x in range(len(S)):
		if S[x] == T[x]:
			M = M + 'G'
		else:
			M = M + 'B'
	print(M)


n = int(input())
for i in range(1, n + 1):
	x = str(input())
	y = str(input())
	s = ''
	for i in range(0, len(x)):
		if x[i] != y[i]:
			s = s + 'B'
		else:
			s = s + 'G'
	print(s)


for i in range(int(input())):
	s1 = input()
	s2 = input()
	l1 = []
	for i in range(5):
		if s1[i] == s2[i]:
			l1.append('G')
		else:
			l1.append('B')
	print(*l1, sep='')