Lokesh usually likes to play cricket, but now, he is bored of playing it too much, so he is trying new games with strings. Lokesh's friend Tina gave him binary strings S and R, each with length N, and told him to make them identical. However, unlike Tina, Lokesh does not have any superpower and Tina lets Lokesh perform only operations of one type: choose any pair of integers (i,j) such that 1≤i,j≤N and swap the i-th and j-th character of S.
#include <stdio.h>
int main()
{
char s[100],r[100];
int t,i,N;
scanf("%d",&t);
while(t--)
{
int count1=0,count2=0;
scanf("%d",&N);
scanf("%s%s",s,r);
for(i=0;i<N;i++)
{
if(s[i]=='1') count1++;
if(r[i]=='1') count2++;
}
if(count1==count2)
printf("YES\n");
else
printf("NO\n");
}
return 0;
}
Comments
Post a Comment