题目:http://acm.hdu.edu.cn/showproblem.php?pid=2087
string a;
cin>>a;
这里的cin是遇到空格停止的。
#include <iostream>
#include <string>
using namespace std;
int main()
{
string a,b;
int cnt;
while(cin>>a && a!="#")
{
cin>>b;
cnt=0;
int tmp=a.find(b,0);
while(tmp!=-1)
{
cnt++;
tmp=a.find(b, tmp+b.length());
}
cout<<cnt<<endl;
}
return 0;
}