Advertisement
Guest User

Untitled

a guest
Dec 14th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. iostream::sync_with_stdio(0); cin.tie(0);
  8. int t;
  9. cin >> t;
  10. for (int xx = 0 ; xx < t ; xx++)
  11. {
  12. string s;
  13. vector <int> ans;
  14. cin >> s;
  15. int n = s.size();
  16. for (int i = 2 ; i < n ; i++)
  17. {
  18. if (s[i - 2] == 't' && s[i - 1] == 'w' && s[i] == 'o')
  19. {
  20. if (i + 2 < n && s[i + 1] == 'n' && s[i + 2] == 'e')
  21. {
  22. ans.push_back(i + 1);
  23. i += 3;
  24. }
  25. else
  26. ans.push_back(i);
  27. }
  28. if (s[i - 2] == 'o' && s[i - 1] == 'n' && s[i] == 'e')
  29. ans.push_back(i);
  30. }
  31. cout << ans.size() << "\n";
  32. for (int x: ans)
  33. cout << x << " ";
  34. cout << "\n";
  35. }
  36. return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement