您的位置:首页 > 其它

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  容器
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: