fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define int long long int
  5. #define ld long double
  6. #define all(x) x.begin(), x.end()
  7. #define sortall(x) sort(all(x))
  8. #define endl '\n'
  9. #define yes cout<<"YES\n";
  10. #define no cout<<"NO\n";
  11. #define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  12. template<class T>
  13. void printC (T Collection)
  14. {
  15. for (auto&i:Collection)
  16. cout << i << " ";
  17. }
  18.  
  19. /*
  20.  * Think twice, code once
  21.  * Think of different approaches to tackle a problem: write them down.
  22.  * Think of different views of the problem. don't look from only one side.
  23.  * don't get stuck in one approach.
  24.  * common mistakes: - over_flow
  25.  * - out_of_bound index
  26.  * - infinite loop
  27.  * - corner cases
  28.  * - duplication counting.
  29. */
  30.  
  31. void solve()
  32. {
  33. int n; cin >> n;
  34. int cnt = 0;
  35. vector<int> ans;
  36. for (int i = 1; i <= n; ++i)
  37. {
  38. char c; cin >> c;
  39. if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u')
  40. {
  41. cnt++;
  42. ans.push_back(i);
  43. }
  44. }
  45. cout << cnt << '\n';
  46. printC(ans);
  47. }
  48.  
  49. int32_t main()
  50. {
  51. #ifndef ONLINE_JUDGE
  52. freopen("input.txt", "r", stdin);
  53. freopen("output.txt", "w", stdout);
  54. freopen("Errors.txt", "w", stderr);
  55. #endif
  56. fast
  57. int t = 1;
  58. cin >> t;
  59. while (t--)
  60. {
  61. solve();
  62. if (t) cout << '\n';
  63. }
  64. cout << '\n';
  65. return 0;
  66. }
Success #stdin #stdout 0s 5288KB
stdin
Standard input is empty
stdout
0