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