# Feedback for TWOSTR problem

Learning course: Strings using C
Problem Link: CodeChef: Practical coding for everyone

### Feedback

include <stdio.h>
include <string.h>

int main(void) {
// your code goes here
int i,t,jay=0;
char x[100],y[100];
scanf(“%d”,&t);
while(t–)
{
scanf(“%s%s”,x,y);
for(i=0;i<strlen(x);i++)
{
if (x[i]==y[i] || x[i]==‘?’ || y[i]==‘?’){
jay++;
}
else{
jay=0;
}
}
if(jay==strlen(x))
{
printf(“Yes\n”);
}
else{
printf(“No\n”);
}
}
return 0;
}

This code is right but still its showing that it has not satisfied one of the testcase, whereas when I’m checking the output for the same testcase on an online complier it is showing the me the correct answer. The expected answer is “YES” and I’m getting the same answer on the online complier but why is codechef showing “No” as the output?

@ni_dhi_07
Just a little mistake .
U have to put jay=0 for each new test case .
Like this.

``````#include <stdio.h>
#include<string.h>
int main(void) {
// your code goes here
int i,t,jay=0;
char x[100],y[100];
scanf("%d",&t);
while(t--)
{
jay=0;
scanf("%s%s",x,y);
for(i=0;i<strlen(x);i++)
{
if (x[i]==y[i] || x[i]=='?' || y[i]=='?'){
jay++;
}
else{
jay=0;
}
}
if(jay==strlen(x))
{
printf("Yes\n");
}
else{
printf("No\n");
}
}
return 0;
}

``````

@ni_dhi_07
You must initialize jay=0; inside the while loop.
Because each time you run the loop jay value must be 0