Why this code is not showing any output

#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;
}

@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.