HDU 2087 剪花布条
2013-04-16 21:38
232 查看
#include<iostream>
#include<string>
using namespace std;
int main()
{
string s1,s2;
int pos;
while(cin>>s1)
{
if(s1=="#")
break;
cin>>s2;
pos=0;
pos=s1.find(s2);
if(pos==-1)
printf("0\n");
else
{
int num=1;
while(1)
{
s1.replace(pos,s2.length(),s2.length(),'#');
pos=s1.find(s2);
if(pos==-1)
break;
else
num++;
}
printf("%d\n",num);
}
}
return 0;
}
string 容器
#include<string>
using namespace std;
int main()
{
string s1,s2;
int pos;
while(cin>>s1)
{
if(s1=="#")
break;
cin>>s2;
pos=0;
pos=s1.find(s2);
if(pos==-1)
printf("0\n");
else
{
int num=1;
while(1)
{
s1.replace(pos,s2.length(),s2.length(),'#');
pos=s1.find(s2);
if(pos==-1)
break;
else
num++;
}
printf("%d\n",num);
}
}
return 0;
}
string 容器
相关文章推荐
- hdu 2087 剪花布条 KMP水题。。
- HDU——2087 剪花布条
- HDU 2087 剪花布条
- HDU 2087 剪花布条 KMP入门
- hdu 2087 剪花布条 与 hdu 1686 Oulipo
- hdu 2087 剪花布条 (kmp入门)
- HDU-2087 - 剪花布条 - KMP
- HDU 2087 剪花布条
- HDU- KMP模板题 - 1686 Oulipo - 2087 剪花布条 - 3746 Cyclic Nacklace
- Hdu-2087 剪花布条
- HDU 2087 剪花布条 && HDU 1686 Oulipo
- HDU-2087 剪花布条 ( kmp )
- HDU---2087--剪花布条
- HDU 2087 剪花布条 [KMP]
- hdu 2087 剪花布条(数据结构:KMP)
- HDU 2087 剪花布条
- HDU - 2087 剪花布条
- hdu 2087 剪花布条
- HDU - 2087 剪花布条
- HDU 2087剪花布条