1
作者:
只想AC.
,
2024-06-16 16:03:28
,
所有人可见
,
阅读 4
#include <bits/stdc++.h>
using namespace std;
int T;
string s, t;
int main()
{
//freopen("delete.in", "r", stdin);
//freopen("delete.out", "w", stdout);
cin >> T;
while (T -- )
{
cin >> s >> t;
int len_s = s.length();
int len_t = t.length();
int is = 0, it = 0, js = len_s, jt = len_t, cnt = 0;
int ans_i = 0;
while (is < js)
{
if(s[is] == t[it])
{
ans_i = is;
break;
}
else is++;
}
is = ans_i;
while (is < js)
{
if (s[is] == t[it]){
is++, it ++, cnt ++;
if (cnt == len_t && (len_s - is) % 2 == 0)
{
puts("YES");
break;
}
}
else
{
if (is == 0)
is ++;
if (cnt + 1 < 2)
{
puts("NO");
break;
}
else if (cnt + 1 == 2)
is ++ , it = 0, cnt = 0;
else if (cnt + 1 > 2)
{
//cout << is << " " << len_s << " " << len_s - is << endl;
// return 0;
if(cnt == len_t && (len_s - is) % 2 == 0)
{
puts("YES");
break;
}
else
{
puts("NO");
break;
}
}
}
}
}
return 0;
}