fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define int long long
  4. bool vowel(char c)
  5. {
  6. string s="aouie";
  7. return count(s.begin(),s.end(),c);
  8. }
  9. signed main()
  10. {
  11. string s;
  12. cin>>s;
  13. if(!vowel(s.back())&&s.back()!='n')
  14. cout<<"NO";
  15. else
  16. {
  17. for(int i=0;i<s.size()-1;i++)
  18. {
  19. if(s[i]=='n')
  20. continue;
  21. if(!vowel(s[i])&&!vowel(s[i+1]))
  22. {
  23. cout<<"NO";
  24. return 0;
  25. }
  26. }
  27. cout<<"YES";
  28. }
  29. }
  30. /*
  31.  
  32. oboboboboooooonb
  33. b
  34. */
Success #stdin #stdout 0.01s 5312KB
stdin
Standard input is empty
stdout
NO