Help me in solving PREQ44 problem

My issue

Update the code below to solve the problem

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

ans = ""

for i,j in zip(S,T):
    if i == j:
        ans = ans + "G"
    else :
        ans = ans + "B"
        
print(ans)

My code

# Update the code below to solve the problem

t = int(input())
for i in range(t):
    S = input()
    T = input()
    
    ans = ""
    
    for i,j in zip(S,T):
        if i == j:
            ans = ans + "G"
        else :
            ans = ans + "B"
            
    print(ans)

Learning course: Design and Analysis of Algorithms
Problem Link: https://www.codechef.com/learn/course/kl-daa/KLDAA24PRE06/problems/PREQ44