提交时间:2022-10-15 11:34:00
运行 ID: 60430
#include<bits/stdc++.h> using namespace std; int t; char a[100001],b[100001]; int main() { ios::sync_with_stdio(false); cin>>t; while(t--) { scanf("%s%s",b,a); int lena=strlen(a); int lenb=strlen(b); if(lenb%lena) { cout<<"NO"<<endl; continue; } int i; for(i=0;i<lenb;) { if(b[i]!=a[i%lena]) { cout<<"NO"<<endl; break; } else i++; } if(i==lenb) cout<<"YES"<<endl; } }