Hi,
For the given problem Problem Code: PLAYSTR (link : CodeChef: Practical coding for everyone) my code is not taking input for a specific test case.
Code :
#include <stdio.h>
void check(char *s,char *r,int n) {
int s1 = 0,s0 = 0,r1 = 0,r0 = 0;
for(int i = 0;i < n;i++) {
if(*(s+i) == '1')
s1++;
else
s0++;
if(*(r+i) == '1')
r1++;
else
r0++;
}
if((s1 == r1) && (s0 == r0))
printf("YES\n");
else
printf("NO\n");
}
int main(void) {
// your code goes here
int t,n;
scanf("%d",&t);
while(t-- > 0) {
scanf("%d",&n);
char s[n];
char r[n];
scanf("%s",s);
scanf("%s",r);
printf("%s\n %s\n",s,r);
check(s,r,n);
scanf("\n");
}
return 0;
}
Input Test cases :
3
5
11000
01001
3
110
001
(the problem test case)
16
1111100000110100
0011000011111000
Output :
11000
01001
YES
110
001
NO
0011000011111000
YES
Here the first string is not being displayed.
I tried with another test case but the input are working for those. Can you please help me point where it could be an issue?