您的位置:首页 > 其它

华为机试:查找字符串

2015-10-12 10:14 344 查看


#include <iostream>
#include <math.h>
#include <map>
#include <vector>
#include <string.h>
#include <memory>
#include <string>
#include <stdio.h>
#include <algorithm>

using namespace std;

int main()
{
string s , p;
int location = 0;
int count = 0;

cin >> s >> p;

location = s.find(p,location);
while(location != string::npos)
{
count++;
location = s.find(p,location + p.size() - 1);
}

cout << count << endl;

return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: