提交时间:2022-10-15 11:28:01

运行 ID: 60360

#include<bits/stdc++.h> using namespace std; void game() { int j; string a,b; cin>>a>>b; int lena=a.length(); int lenb=b.length(); if(lena%lenb!=0) { cout<<"NO\n"; return; } for(int i=0;i<lena;i++){ j=i%lenb; if(a[i]!=b[j]) { cout<<"NO\n"; return; } } cout<<"YES\n"; } int main() { // freopen("J1.in","r",stdin); // freopen("J1.out","w",stdout); ios::sync_with_stdio(0),cin.tie(0); int t; cin>>t; for(int i=0;i<t;i++) game(); return 0; }