标签:
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 8916 Accepted Submission(s):
4056
#include<stdio.h> #include<string.h> int main() { char s1[100010]; char s2[100010]; char s3[200001]; int n,i,j,l1,l2; while(scanf("%s\n%s",s1,s2)!=EOF) { l1=strlen(s1); l2=strlen(s2); if(l2>l1) //注意判断如果l2>l1则l2不可能包含在l1中 printf("no\n"); else { strcpy(s3,s1); //复制字符串 strcat(s1,s3); //拼接字符串 if(strstr(s1,s2)) //判断s2是否为s1子串 printf("yes\n"); else printf("no\n"); } } return 0; }
标签:
原文地址:http://www.cnblogs.com/tonghao/p/4354326.html