Problem Name :  Chef and the Wildcard Matching

Problem Link :  See This Problem

Solution  :

#include<bits/stdc++.h>

#define pb push_back
#define read freopen("input.txt","r",stdin)
#define write freopen("output.txt","w",stdout)
#define rev(s) std::reverse(s.begin(), s.end());
#define up std::transform(s.begin(), s.end(), s.begin(), ::toupper);
///string sb=s.substr(1,3);
#define low std::transform(s.begin(), s.end(), s.begin(), ::tolower);
#define n2s(n) stringstream ss; ss<<n; string s=ss.str();
#define CC(x) cout<<(x)<<endl
#define srt sort(a,a+n);
#define rep(n) for(int i=0;i<n;i++)
typedef long long LL;

using namespace std;

int main()
{
    LL t,l;
    string s,S;
    cin>>t;
    while(t--)
    {
        LL ss=0,SS=0;
        cin>>s>>S;
        l=s.size();
        rep(l)
        {
            if(s[i]!=S[i])
            {
                ss=0;
                if(s[i]!='?'){ss++;}
                if(S[i]!='?'){ss++;}
                if(ss==2){cout<<"No"<<endl; break;}
            }
        }
        if(ss!=2){cout<<"Yes"<<endl;}
    }
    return 0;
}
Advertisements