题目:http://acm.hdu.edu.cn/showproblem.php?pid=2203
这道题基本来说很简单,只要会用find这个函数,
eg:
查看: 字符串是否包含子串 如果包含 则返回子串在目标串中第一次出现的位置
string str12= "I am a student", str13= "student", str14="aaaaaaa";
if( str12.find( str13 )!= -1 ) cout << "Find " << str13<< endl;
if( str12.find( str14 )== -1 ) cout << "Not Find *****************************************************************************************
#include <iostream>
using namespace std;
int main()
{
string str1,str2;
char s;
int flag,a,b;
while(cin>>str1>>str2)
{
a=str1.length();
b=str2.length();
if(a<b)
cout<<"no"<<endl;
else
{
flag=0;
for(int i=0;i<b;i++)
{
s=str1[0];
str1.erase(0,1);
str1+=s;
if(str1.find(str2)!=-1)
flag=1;
}
if(flag)
cout<<"yes"<<endl;
else
cout<<"no"<<endl;
}
}
return 0;
}