I am now trying to do it with the greedy approach as specified in editorial but something’s wrong . Please help me in figuring it out.
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
main(){
ll t;
cin>>t;
while(t--){
string l1,l2;
cin>>l1>>l2;
ll l1l=l1.length(),l2l=l2.length(),res=0,i;bool q=-1;
for(i=0;i<l1l;i++){
if(l1[i]=='#'&&l2[i]=='#'){
res=INT_MAX;break;
}
else if(l1[i]=='#'){
if(q==1)
res++;
q=0;
}
else if(l2[i]=='#')
{
if(q==0)
res++;
q=1;
}
}
if(res==INT_MAX)
cout<<"No"<<endl;
else
cout<<"Yes"<<endl<<res<<endl;
}
return 0;
}