# MEENA_004 Editorial

Practice

Author: Yogesh Deolalkar
Tester: Ram Agrawal
Editorialist: Prathamesh Sogale

# DIFFICULTY:

CAKEWALK, SIMPLE.

String, Math

# PROBLEM:

You are given two binary strings S and P. You need to convert S into P using the following operation any number of times (possibly zero):

Pick three binary values X, Y, and Z, such that at least one of them is equal to 1 and at least one of them is equal to 0. Then, pick three distinct indices i, j, and k, and assign Si=X, Sj=Y, and Sk=Z. Determine whether it’s possible to convert S into P.

Setter's Solution

for i in range(int(input())):
n = int(input())
s = str(input())
p = str(input())
a = p.count(‘1’)
if a == n or a == 0:
if s == p:
print(“YES”)
else:
print(“NO”)
else:
print(“YES”)

Tester's Solution

for t in range(int(input())):
n=int(input())
b1=input()
b2=input()
s=’’
if(b1==b2):
print(“YES”)

``````elif(len(b1)!=len(b2)):
print("NO")

else:
for i in range(len(b1)):
if(b1[i]!=b2[i]):
s+=b2[i]

if(s.count("1")==0 or s.count("0")==0):
print("NO")
else:
print("YES")
``````