Code is given below

#include<bits/stdc++.h>
using namespace std;
vector str(string str)
{
vectorv;
int n;
n=str.length();
for(int i=0;i<n;i++)
v.push_back(str[i]);
return v;

}
int main()
{
int m;
cin>>m;
char c1[100];
char c2[100];
int n;
vectorv;
vectorv1;
vectorv2;
vector<pair<vector,vector>>v3;
vector<vector>v4;
for(int k=0;k<m;k++)
{
cin>>c1>>c2;
v1=str(c1);
v2=str(c2);
v3.push_back(make_pair(v1,v2));
}
n=v1.size();
for(int x=0;x<m;x++)
{
for(int i=0;i<n;i++)
v.push_back((v3[x].first)[i]^(v3[x].second)[i]);
v4.push_back(v);
v.clear();
}
for(auto x:v4)
{
for(int l=0;l<n;l++)
cout<<x[l];
cout<<endl;
}
return 0;
}

:bulb: Ultra-Fast-Mathematicians

Search Content
Search Icon
Course Progress

hey @CHANDU_0556 you dont need to make your code this complex the approach is pretty simple if s1[i] is equal to s2[i] print 0, else 1.

#include<bits/stdc++.h>
using namespace std;
int main() {
	int t;
	cin >> t;
	while(t--){
		string s1, s2;
		cin >> s1 >> s2;
		for(int i = 0; i < s1.length(); i++){
			if(s1[i] == s2[i])
				cout << '0';
			else
				cout << '1';
		}
		cout << endl;
	}
}

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.