<span style="font-size:14px;">#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
int n;
string str1;
string str2;
cin >> n;
while (n--) {
cin >> str1 >> str2;
size_t found = 0;
int iTime = 0;
while ((found = str2.find(str1,found)) != string::npos) {
iTime++;
found++;
}
cout << iTime << endl;
}
return 0;
}</span>
统计str1 在str2里出现的总次数
统计字符串A 在字符串B出现的个数
最新推荐文章于 2022-09-09 20:49:56 发布