# Help me in solving ST04 problem

### My issue

not able to understand the logic behind the 15th line of the code

### My code

``````#Update the '_' in the code below to solve this problem

t = int(input())
for i in range(t):
A = input()
B = input()

i = 0
n = len(A)
#Flag is a very imporant tool in programming problems - you will come across various examples in later problems as well
flag = 0

while i<n:
#Checking A from left to right and B from right to left
if A[i]==B[n-i-1]:
i = i + 1
else:
#If specific character in A and B do not match, then they cannot be reverse of each other
flag = 1
break

if flag==1:
print('NO')
else:
print('YES')
``````

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

The logic here is that

1. in while loop, we are checking from left to right in A string and from right to left in B string
2. if we are getting same characters then we just move on
3. but when we get different characters in A and B for a particular index, we just mark flag=1, which denotes that we got different characters.
4. As, we got different characters, so there is no meaning of checking further. We just break the loop and come out.