Untitled

mail@pastecode.io avatar
unknown
plain_text
7 days ago
905 B
2
Indexable
Never
#include <bits/stdc++.h>
typedef long long int llint;
using namespace std;

int main()
{
    int t;
    cin >> t;
    while (t--)
    {
        string str1, str2;
        cin >> str1 >> str2;
        int x = 0, y = 0;
        int lenx = str1.length(), leny = str2.length();
        bool flag = false;
        while (true)
        {
            if (lenx == x && leny == y)
            {
                break;
            }
            else if (lenx == x)
            {
                break;
            }
            else if (leny == y)
            {
                flag = true;
                break;
            }
            if (str1[x] == str2[y] || str1[x] == '?') {
                y++;
            }
            x++;
        }
        if (flag) {
            cout << "YES" << endl;
        }  else {
            cout << "NO" << endl;
        }
    }
}

Leave a Comment