Advertisement
Ashot_27

Untitled

Dec 14th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. #define int long long
  6.  
  7. int32_t main() {
  8. int t; cin >> t;
  9. while (t--) { vector<int> res; string s; cin >> s; s += "WWWWWW";
  10. for (int i = 0; i < s.size(); i++) if (s[i + 1] == 'w' && s[i + 3] == 'n' && s[i] == 't' && s[i + 4] == 'e' && s[i + 2] == 'o')
  11. res.push_back(i + 2), s[i + 2] = 'W';
  12. for (int i = 0; i < s.size(); i++) if (s[i] == 'o' && s[i + 1] == 'n' && s[i + 2] == 'e')
  13. res.push_back(i + 1), s[i + 1] = 'W';
  14. for (int i = 0; i < s.length(); i++) if (s[i] == 't' && s[i + 1] == 'w' && s[i + 2] == 'o')
  15. res.push_back(i + 1), s[i + 1] = 'W';
  16. cout << res.size() << "\n"; for (auto idx : res) cout << idx + 1 << " "; cout << "\n";
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement