fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. string s;
  4. int main(){
  5. while(cin >> s){
  6. if(s == "end") break;
  7. bool hasVowel = false, isImp = false;
  8. int vow = 0, con = 0;
  9. for(int i = 0; i < s.size(); i++){
  10. if(s[i] == 'a' || s[i] == 'e' || s[i] == 'i' || s[i] == 'o' || s[i] == 'u'){
  11. hasVowel = true;
  12. vow++;
  13. con = 0;
  14. } else {
  15. con++;
  16. vow = 0;
  17. }
  18.  
  19. if(vow >= 3 || con >= 3) isImp = true;
  20. if(i < s.size() + 1 && s[i] != 'e' && s[i] != 'o' && s[i] == s[i + 1]) isImp = true;
  21. }
  22. if(hasVowel && !isImp) cout << "<" << s << "> is acceptable.\n";
  23. else cout << "<" << s << "> is not acceptable.\n";
  24. }
  25. }
Success #stdin #stdout 0s 5320KB
stdin
a
tv
ptoui
bontres
zoggax
wiinq
eep
houctuh
end
stdout
<a> is acceptable.
<tv> is not acceptable.
<ptoui> is not acceptable.
<bontres> is not acceptable.
<zoggax> is not acceptable.
<wiinq> is not acceptable.
<eep> is acceptable.
<houctuh> is acceptable.