Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- iostream::sync_with_stdio(0); cin.tie(0);
- int t;
- cin >> t;
- for (int xx = 0 ; xx < t ; xx++)
- {
- string s;
- vector <int> ans;
- cin >> s;
- int n = s.size();
- for (int i = 2 ; i < n ; i++)
- {
- if (s[i - 2] == 't' && s[i - 1] == 'w' && s[i] == 'o')
- {
- if (i + 2 < n && s[i + 1] == 'n' && s[i + 2] == 'e')
- {
- ans.push_back(i + 1);
- i += 3;
- }
- else
- ans.push_back(i);
- }
- if (s[i - 2] == 'o' && s[i - 1] == 'n' && s[i] == 'e')
- ans.push_back(i);
- }
- cout << ans.size() << "\n";
- for (int x: ans)
- cout << x << " ";
- cout << "\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement