提交时间:2022-10-15 11:36:59

运行 ID: 60438

#include <bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); // freopen("J1.in","r",stdin); // freopen("J1.out","w",stdout); int t; cin>>t; while (t--){ string a,b,c; cin>>a>>b; int flag = 0; int len1 = a.length(); int len2 = b.length(); if ((len1)%(len2) != 0){ cout<<"NO"<<endl; flag = 1; } else for (int i=0;i<len1;i+=len2){ for (int j=i;j<len2;j++){ c+=a[j]; } if (c == b) continue; else { cout<<"NO"<<endl; flag = 1; break; } } if (!flag){ cout<<"YES"<<endl; } } return 0; }