[백준] 4659 비밀번호 발음하기
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
while (true) {
string input;
cin >> input;
if (input == "end") break;
bool acceptable = true;
bool mIncluded = false;
int mSeq = 0;
int jSeq = 0;
int len = input.length();
for (int i = 0; i < len; ++i) {
if ((input[i] == 'a') || (input[i] == 'e') || (input[i] == 'i') || (input[i] == 'o') || (input[i] == 'u')) {
mIncluded = true;
mSeq++;
jSeq = 0;
}
else {
jSeq++;
mSeq = 0;
}
if ((mSeq == 3) || (jSeq == 3)) {
acceptable = false;
break;
}
if ((i + 1 < len)&&(input[i] == input[i + 1])){
if ((input[i] == 'e') || (input[i] == 'o')) continue;
acceptable = false;
break;
}
}
if (!mIncluded) acceptable = false;
if (acceptable) {
cout << "<" << input << "> is acceptable.\n";
}
else {
cout << "<" << input << "> is not acceptable.\n";
}
}
return 0;
}