Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define ll long long
- #define _test int _TEST; cin>>_TEST; while(_TEST--)
- ///DEBUG
- int main()
- {
- _test
- {
- int n, m;
- cin>>n>>m;
- string a, b;
- cin>>a>>b;
- int ans = -1;
- for(int i=0; i<=10; i++)
- {
- if(a.find(b) != string::npos)
- {
- ans = i;
- break;
- }
- a += a;
- }
- cout<<ans<<"\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment