你这代码保熟吗?(鸡叫) • 1年前
using namespace std;
int main() {
string a, b;
getline(cin, a);
getline(cin, b);
int c = - 1, d = b.size(), x = 0, z = 0;
for (int i = 0; i < d; i++) {
x = b.find(a, i);
if (x >= 0 && x < d && x != c) {
z++;
}
c = x;
}
cout << z;
return 0;
}
评论:
请先登录,才能进行评论