题意
链接: link.
思路
反过来暴力模拟
AC代码
#include <bits/stdc++.h>
using namespace std;
string a, b;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t;
cin >> t;
while (t--)
{
cin >> a >> b;
reverse(a.begin(), a.end());
reverse(b.begin(), b.end());
int pos = 0;
bool flag = 0;
for (auto &op : a)
{
if (flag)
{
flag = 0;
continue;
}
if (op == b[pos])
pos++;
else
flag = 1;
if(pos==b.size())
break;
}
puts(pos == b.size() ? "YES" : "NO");
}
// system("pause");
return 0;
}