# Help me in solving ST07 problem

### My issue

i couldn’t understand the problem and logic behind the solution , it would be great if someone helps me out on this

### My code

``````# Solution as follows

t = int(input())
for i in range(t):
S = input()
T = input()

M = ""
i = 0
while i < len(S):
#If the i element in S and T are the same, then the i element in M is G
if S[i] == T[i]:
M = M + 'G'
#If the i element in S and T are not the same, then the i element in M is B
else:
M = M + 'B'
i = i + 1

print(M)
``````

Learning course: Python for problem solving - 2
Problem Link: CodeChef: Practical coding for everyone

Let me explain you with an example
Suppose S=“Joseph” and T=“Jonahi”
Here S[0]=‘J’ and T[0]=‘J’
Hence S[0]=J[0], So ‘G’ is added to string M.
S[1]=‘o’ and T[1]=‘o’
Hence S[1]=T[1], So ‘G’ is again added to the string M.
It compares the characters of S and M till the end of string.
If S[i]!=T[i] then ‘B’ is added to the string M.
Hence the output of the string M will be M=“GGBBBB”