/* Affinity string
Time Limit: 3000/1000 MS (Java/others) memory limit: 32768/32768 K (Java/Others)
Total submission (s): 7946 accepted submission (s): 3656
Problem description
As the age increases, people become smarter and more stupid. This is a question worthy of thinking from scientists around the world. Eddy has been thinking about the same problem, when he was very young, he knew how to judge the affinity string. But he found that when he was growing up, he did not know how to judge the affinity string, so he had to ask you again to solve the problem with a smart and helpful person.
The affinity string is defined as follows: Given two strings S1 and S2, if S2 can be contained in S1 through S1 cyclic shift, then S2 is the affinity string of S1.
Input
This topic contains multiple groups of test data. The first line of each group contains the input string S1, the second line contains the input string S2, And the S1 and S2 length are less than 100000.
Output
If S2 is an S1 affinity string, "yes" is output; otherwise, "no" is output ". The output of each group of tests occupies one row.
Sample Input
Aabcd
Cdaa
ASD
ASDF
Sample output
Yes
No
*/
/* Strstr () function searches for the first occurrence of a string in another string. Find the searched string,
The function returns the address of the first matched string. If the searched string is not found, null is returned. */
// Train of thought: Copy string S1 and S2 using strstr function. If the return value is not null, yes is output;
# Include <stdio. h>
# Include <string. h>
# Define n 200010
Int main ()
{
Char S1 [N], S2 [N], S3 [N];
While (gets (S1 )! = NULL)
{
Getchar ();
Gets (S2 );
Strcpy (S3, S1 );
Strcat (S3, S1 );
If (strstr (S3, S2 ))
Printf ("Yes \ n ");
Else
Printf ("NO \ n ");
}
Return 0;
}
Affinity string (hangdian 2203)