Having problem in submitting code , test case is running fine

Contest Code:LP1TO203

Problem Code:TWOSTR
Not able to get my submission right , but test case is runnig fine.
My code:
#include<bits/stdc++.h>

using namespace std;

int main() {

int t;

cin>>t;



while(t>0){

    string x,y;

    cin>>x>>y;

int a=x.length();

int b=y.length();

bool equal;

if(a==b){

for(int i=0;i<a;i++){

    if(x[i]==y[i] || x[i]=='?' || y[i]=='?'){

        equal=true;

    }

    else{

        cout<<"NO"<<endl;

        equal=false;

        break;

    }

}

if(equal){

    cout<<"YES"<<endl;

}

}

else {

cout<<"NO"<<endl;

}

t–;

}

return 0;

}

Check the following update to your code.

Accepted