#include
#include
using namespace std;
int main() {
int t;
cin>>t;
while(tβ)
{
string s1;
string s2;
string s3;
cin>>s1;
cin>>s2;
int i=0,j=0,k=0;
while(i<s1.length() && j<s2.length())
{
if(s1[i]==s2[j])
{
s3[k]=β0β;
}
else
{
s3[k]=β1β;
}
i++;
j++;
k++;
}
cout<<s3;
}
return 0;
}
Why this code is not showing any output
@Kunalgoyal
Actually the problem is initial length of s3 is zero. So s3[k] is not define. You cannβt directly initial any index of s3. Instead of doing s3[k]=β0β or s3[k]=β1β what you can do is change them to s3+=β0β; and s3+=β1β; respectively
I hope Iβve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.