题意:如题。
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <iostream>
using namespace std;
bool vowel(char c)
{
return c == 'a' || c == 'e' || c == 'i'
|| c == 'o' || c == 'u';
}
bool consonant(char c)
{
return !vowel(c);
}
bool except(char c)
{
return c != 'e' && c != 'o';
}
void deal(string& line)
{
bool vowel_exist = false;
bool ok = true;
for (int i = 0; i < line.length() && ok; ++i)
{
if (vowel(line[i]))
{
vowel_exist = true;
if (i < line.length()-2 && vowel(line[i+1]) && vowel(line[i+2]))
ok = false;
}
else
{
if (i < line.length()-2 && consonant(line[i+1]) && consonant(line[i+2]))
ok = false;
}
if (i < line.length()-1 && line[i] == line[i+1] && except(line[i]))
ok = false;
}
if (!vowel_exist) ok = false;
cout << "<" << line << ">" << " is " << (ok ? "" : "not ")
<< "acceptable." << endl;
}
int main()
{
//freopen("1.txt", "r", stdin);
string line;
while (getline(cin, line))
{
if (line == "end")
break;
deal(line);
}
return 0;
}