HDU 2203 亲和串 (想法题,字符串处理)
2014-06-18 17:55
316 查看
给定两个字符串s1和s2,如果能通过s1循环移位,使s2包含在s1中,那么我们就说s2 是s1的亲和串。S1+S1后进行查找即可
#include<iostream> #include<sstream> #include<vector> #include<string> #include<algorithm> using namespace std; int main() { string s1,s2; while(cin>>s1) { cin>>s2; s1=s1+s1; int ans=s1.find(s2); if(ans!=-1) cout<<"yes"<<endl; else cout<<"no"<<endl; } return 0; }
相关文章推荐
- HDU1727——字符串处理
- HDU1894——字符串处理
- HDU 1073 Online Judge (字符串处理,简单题)
- hdu 1062 字符串处理
- hdu 2734 简单地字符串处理
- HDU 1020 Encoding (字符串处理)
- hdu 1062 字符串处理
- HDU 3819 A and B Problem 对字符串进行处理
- HDU 1014 字符串处理
- hdu 2412 (disney) 模拟、字符串处理
- 【W】HDU2206——字符串处理(IP计算)
- hdu 1106(字符串处理+排序)
- hdu 1219(字符串处理)
- hdu 4054 字符串处理
- HDU 1088 处理每个字符串比直接用getchar处理简单
- HDU1804——字符串处理
- hdu 3973 AC's String 字符串哈希处理 查询子串是否是模式串 可以修改
- HDU-1039 字符串处理
- 【HDU 3183】 字符串处理
- hdu 1048 字符串处理