#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<iostream>
#include<set>
#include<vector>
using namespace std;
bool vow(char ch) //是否是元音
{
if(ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u' || ch == 'y'
|| ch == 'A' || ch == 'E' || ch == 'I' || ch == 'O' || ch == 'U' || ch == 'Y')
return true;
return false;
}
void solve(vector<string> &vec, char ss[]) //将每句话分解为单词,紧跟在单词后的标点符号和单词合并
{
int len = strlen(ss);
string tmp = "";
for(int i = 0; i < len; i++)
{
if(ss[i] != ' ')
tmp += ss[i];
else
{
if(tmp != " ")
{
vec.push_back(tmp);
tmp = "";
}
}
}
}
int judge(string s) //返回一个单词的音节数
{
int len = s.length();
int sum = 0;
bool flag = false;
while(!isalpha(s[len - 1])) len--; //如果该单词尾部有标点符号,则处理时len--
int up = len;
if(s[len - 1] == 'e' || s[len - 1] == 'E') //以e结尾的倒数三个留出来最后判断
up -= 3;
if( (s[len - 2] == 'e' || s[len - 2] == 'E') && (s[len - 1] == 's' || s[len - 1] == 'S') )
up -= 4; //以es结尾的倒数四个留出来最后判断
for(int i = 0; i < up; i++)
{
if(!vow(s[i]))
{
flag = false; continue;
}
if( !flag && (s[i] == 'Y' || s[i] == 'y') ) //注意y的处理,如果此处的y符合此条件,后面紧跟辅音,此处改变flag与否均可(后面碰到辅音也改变了);如果后面紧跟不是辅音,则可能还有会加其他元音,也不应该改变flag(如lawyer)
{
if(!vow(s[i + 1]))
sum++;
continue;
}
if(!flag && vow(s[i]))
{
if((s[i] == 'U' || s[i] == 'u') && (s[i - 1] == 'Q' || s[i] == 'q')) continue;
sum++; flag = true;
}
}
if(s[len - 1] == 'e' || s[len - 1] == 'E')
{
for(int i = up; i < len; i++)
{
if(!vow(s[i - 3]) && (s[i - 2] == 'l' || s[i - 2] == 'L'))
sum++;
}
}
if( (s[len - 2] == 'e' || s[len - 2] == 'E') || (s[len - 1] == 's' || s[len - 1] == 'S') )
{
if(!vow(s[len - 4]) && !vow(s[len - 3]))
sum++;
}
return sum;
}
int main()
{
char ss[210];
while(gets(ss) && strcmp(ss, "\n") != 0)
{
int sum = 0;
bool f1 = false, f2 = false, f3 = false;
vector<string> vec; //拆解句子后的单词集合
vector<string> l1, l2, l3; //保存三行要输出的单词
solve(vec, ss);
int sz = vec.size();
for(int i = 0; i < sz; i++)
{
int syl = judge(vec[i]);
sum += syl;
if(sum < 5)
{
l1.push_back(vec[i]);
}
if(sum == 5)
{
l1.push_back(vec[i]);
f1 = true;
}
if(sum > 5 && !f1) continue;
if(f1 && sum > 5 && sum < 12)
{
l2.push_back(vec[i]);
}
if(sum == 12)
{
l2.push_back(vec[i]);
f2 = true;
}
if(sum > 12 && !f2) continue;
if(f2 && sum > 12 && sum < 17)
{
l3.push_back(vec[i]);
}
if(sum == 17)
{
l3.push_back(vec[i]);
f3 = true;
}
if(sum > 17)
continue;
}
if(sum == 17 && f1 && f2 && f3)
{
for(int i = 0; i < l1.size(); i++)
cout << l1[i] << " ";
cout << endl;
for(int i = 0; i < l2.size(); i++)
cout << l2[i] << " ";
cout << endl;
for(int i = 0; i < l3.size(); i++)
cout << l3[i] << " ";
cout << endl;
}
else
cout << ss << endl;
}
return 0;
}