Any error in the logic?

/*It satisfies all the base test cases and I did some dry run on other test cases as well and it worked but still shows me a WA. Can someone help me find issues in it?
The question code is XORMAX */

#include <bits/stdc++.h>
using namespace std;
#define ll long long

void solve(){
string a,b,temp;
cin>>a;
cin>>b;
int n=a.length();
int count0=0,count1=0;
for(int i=0;i<n;i++){
if(b[i]==‘0’)
count0++;
else
count1++;
}
for(int i=0;i<n;i++){
if(a[i]==‘0’){
if(count1>0){
temp+=‘1’;
count1–;
}
else{
temp+=‘0’;
count0–;
}
}
else if(a[i]==‘1’){
if(count0>0){
temp+=‘0’;
count0–;
}
else{
temp+=‘1’;
count1–;
}
}
}
for(int i=0;i<n;i++){
if(a[i]==‘0’ && temp[i]==‘1’ || a[i]==‘1’ && temp[i]==‘0’)
cout<<1;
else
cout<<0;
}
cout<<endl;
}

int main() {
int t;
cin>>t;
while(t–){
solve();
}
return 0;
}