#include<bits/stdc++.h> #define int long long #define endl '\n' using namespace std; signed main() { int n;cin>>n; cin.ignore(); string s; string sub; sub="shenchuan"; getline(cin,s); int cnt=0; size_t first=s.find(sub); if(s.find(sub)==string::npos) { cout<<0; return 0; } else { size_t tmp=first; while(tmp!=string::npos) { cnt++; tmp=s.find(sub,tmp+1); } cout<<cnt<<endl; } size_t tmp=first; while(tmp!=string::npos) { cout<<tmp<<' '; tmp=s.find(sub,tmp+1); }
return 0; }

0 comments

No comments so far...

Information

ID
55
Time
ms
Memory
MiB
Difficulty
10
Tags
(None)
# Submissions
315
Accepted
2
Uploaded By