1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| #include <bits/stdc++.h> using namespace std; map<string,queue<pair<string,int>>> mp;
int main(){ string s; char ch; cin>>s>>ch; ch = tolower(ch); int len = s.size(),a1; for(int i=0;i<len;i++){ if(tolower(s[i])==ch){ a1 = i; break; } } int a2; for(int i=a1+1;i<len;i++){ if(tolower(s[i])==ch){ a2 = i; cout<<a2-a1<<" "; a1 = a2; } } cout<<endl; }
|