Created
July 22, 2016 08:08
-
-
Save oskimura/7a53202d30be7abb65e834cbbbb58495 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string> | |
#include <iostream> | |
using namespace std; | |
int main() | |
{ | |
string s; | |
string p; | |
// scanf("%s\n",&s); | |
//scanf("%s\n",&p); | |
cin >> s; | |
cin >> p; | |
int len = s.size(); | |
for (int i=0;i<len;i++) { | |
bool flag = true; | |
for (int j=0; j<p.size() ;j++) { | |
if (s[(i+j)%len] != p[j]) { | |
flag = false; | |
} | |
} | |
if (flag) { | |
printf("Yes\n"); | |
return 0; | |
} | |
} | |
printf("No\n"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment