You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
858 B
C++
42 lines
858 B
C++
#define _CRT_SECURE_NO_WARNINGS
|
|
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
|
|
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
int main()
|
|
{
|
|
int T;
|
|
scanf("%d", &T);
|
|
while (T--)
|
|
{
|
|
string s, t;
|
|
cin >> s >> t;
|
|
int sl = s.length();
|
|
int tl = t.length();
|
|
if (sl - 2 != tl)
|
|
{
|
|
puts("0");
|
|
continue;
|
|
}
|
|
int cur = 0, cut = 0;
|
|
bool ok = 1;
|
|
for (int i = 0; i < sl; i++)
|
|
{
|
|
if (s[i] == t[cur])
|
|
{
|
|
cur++;
|
|
continue;
|
|
}
|
|
else
|
|
{
|
|
cut++;
|
|
}
|
|
if (cut > 2) ok = 0;
|
|
}
|
|
if (ok && cut == 2)
|
|
puts("1");
|
|
else
|
|
puts("0");
|
|
}
|
|
return 0;
|
|
}
|