3099. 字符串的旋转

Naive函数字符串

时间限制:2000 ms

内存限制:256 MiB

题面

国外某知名 IT 企业有一个招聘题 :

Enter two strings, s1s_1 and s2s_2, with length no more than 8080, write code to check if s2s_2 is a rotation of s1s_1.

在一行中输入 22 个字符串 s1s_1s2s_2,字符串本身不含空格的字符串 (长度均不超过 8080),22 个字符串之间以 11 个空格分隔。

在一行中输出相关判断结果 (格式见例子)。

例如:

输入:waterbottle erbottlewat

输出:"waterbottle" is a rotation of "erbottlewat"

又如:

输入:water erbottlewat

输出:"water" is NOT a rotation of "erbottlewat"

/***************************************************************/
/*                                                             */
/*  DON'T MODIFY main function ANYWAY!                         */
/*                                                             */
/***************************************************************/

#include <stdio.h>
#include <string.h>

int isRotation(char s1[],char s2[])
   /* PreCondition:  s1和s2是长度不超80的两个字符串
     PostCondition: s2可以是s1经过循环移动后得到时返回1,否则0
   */
{
	//TODO: your function definition
	
}

/***************************************************************/
#define N 80
int main()
{
	char s[N+1],t[N+1];
	scanf("%s%s",s,t);
	
	//********** isRotation is called here *************
	if(isRotation(s,t)) printf("\"%s\" is a rotation of \"%s\"\n",s,t);
	else printf("\"%s\" is NOT a rotation of \"%s\"\n",s,t);
	//**************************************************

	return 0;
}

样例

输入

waterbottle erbottlewat

输出

"waterbottle" is a rotation of "erbottlewat"