#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int rotation(char *str1, char *str2) {
int size1 = strlen(str1);
int size2 = strlen(str2);
if (size1 != size2)
return 0;
char *tmp = (char *)malloc(sizeof(char) * (size1 * 2 + 1));
tmp[0] = '\0';
strcat(strcat(tmp, str1), str1);
puts(tmp);
char *p = strstr(tmp, str2);
free(tmp);
if (p != NULL)
return 1;
else
return 0;
}
int main()
{
char *str1 = "abcxd", *str2 = "cxdab";
if (rotation(str1, str2))
puts("yes");
else
puts("no");
return 0;
}
/*
run:
abcxdabcxd
yes
*/