#include <iostream>
using namespace std;
int main()
{
  freopen("first.txt", "r", stdin);
  freopen("second.txt", "w", stdout);
  string s;
  getline(cin, s);
  for (int i = 0; i < s.size()-1; i++) {
    if (s[i]==' ' && (s[i+1]=='a' || s[i+1]=='e' || s[i+1]=='i' || s[i+1]=='o' || s[i+1]=='u')) {
      int j = i+1;
      bool test = true;
      while (test) {
        cout << s[j];
        j++;
        if (j==s.size() || s[j]==' ') test = false;
      }
      cout << '\n';
    }
  }
  return 0;
}
Example:
first.txt:
hakuna azimjon matata euler
Output at second.txt:
azimjon
euler
archimedes
Comments
Leave a comment