You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
503 B
C++

#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 50;
char s1[N << 1], s2[N];
int main()
{
while (~scanf("%s%s", s1, s2))
{
auto l1 = strlen(s1), l2 = strlen(s2);
if (l2 > l1)
puts("no");
else
{
memcpy(s1 + l1, s1, l1), s1[l1 << 1] = 0;
puts(strstr(s1, s2) ? "yes" : "no");
}
}
return 0;
}