提交时间:2022-07-19 12:04:35
运行 ID: 52383
//runes #include <bits/stdc++.h> using namespace std; inline int read(){ register int x(0); register short w(1); register char c(getchar()); for (;c < '0' || c > '9';c = getchar()) if (c == '-') w = -1; for (;c >= '0' && c <= '9';c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48); return x * w; } const int N(5e5 + 10); int T; int main(){ T = read(); while (T--){ string S,R;cin >> S >> R; int a(read()),b(read());int len(S.length());if (S == R) cout << "yes\n";string S1 = S,R1 = R,S2 = S,R2 = R,S3 = S,R3 = R; string s1(S.erase(a,len)),r1(R.erase(0,len - a)),s2(S1.erase(0,a)),r2(R1.erase(len - a,a));//cout << s1 << endl << r1 << endl << s2 << endl << r2 << endl; string s3(S2.erase(b,len)),r3(R2.erase(0,len - b)),s4(S3.erase(0,b)),r4(R3.erase(len - b,b));//cout << s3 << endl << r3 << endl << s4 << endl << r4 << endl; if (s1 == r1 && s2 == r2) cout << "yes\n"; else if (s3 == r3 && s4 == r4) cout << "yes\n"; else cout << "no\n"; } return 0; }