Your Name is Mine

I have written the code right but it shows wrong. I checked some other successful solutions and found one of the code which was written in same manner but got accepted. I don’t know why mine isn’t accepted.

Can someone help me with this.

My code is below :

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

bool is_sub(string &s1, string &s2){

int i=0,j=0;
while(i<s1.length() && j<s2.length() ){
    if(s1[i] == s2[j])  i++;
    
    j++;
}


return i==s1.size();

}

int main() {

int t;
cin>>t;
while(t--){
    string s1,s2;
    cin>>s1>>s2;
    if(is_sub(s1,s2) || is_sub(s2,s1)) cout<<"Yes"<<endl;
    else            cout<<"No"<<endl;
}
return 0;

}