hdu1039
来源:互联网 发布:同声翻译手机软件知乎 编辑:程序博客网 时间:2024/05/28 05:19
#include<stdio.h>
#include<iostream>
#include<string>
using namespace std;
bool f(char c)
{
if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u') return true;
return false;
}
int main()
{
string s;
while(cin>>s&&s!="end")
{
int length=s.length();
int i=0;
int flag=1;
int count_vowel=0;
for(i=0;i<length;i++)
{
if(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u') count_vowel++;
if(i<length-2&&length>=3&&((f(s[i])&&f(s[i+1])&&f(s[i+2]))||(!f(s[i])&&!f(s[i+1])&&!f(s[i+2]))))
{
cout<<"<"<<s<<"> is not acceptable.\n";
flag=0;
break;
}
if(i<length-1&&length>=3&&s[i]==s[i+1]&&s[i]!='e'&&s[i]!='o')
{
cout<<"<"<<s<<"> is not acceptable.\n";
flag=0;
break;
}
}
if(flag==0) continue;
if(count_vowel==0)
{
cout<<"<"<<s<<"> is not acceptable.\n";
flag=false;
}
if(flag)
{
cout<<"<"<<s<<"> is acceptable.\n";
}
}
return 0;
}
#include<iostream>
#include<string>
using namespace std;
bool f(char c)
{
if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u') return true;
return false;
}
int main()
{
string s;
while(cin>>s&&s!="end")
{
int length=s.length();
int i=0;
int flag=1;
int count_vowel=0;
for(i=0;i<length;i++)
{
if(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u') count_vowel++;
if(i<length-2&&length>=3&&((f(s[i])&&f(s[i+1])&&f(s[i+2]))||(!f(s[i])&&!f(s[i+1])&&!f(s[i+2]))))
{
cout<<"<"<<s<<"> is not acceptable.\n";
flag=0;
break;
}
if(i<length-1&&length>=3&&s[i]==s[i+1]&&s[i]!='e'&&s[i]!='o')
{
cout<<"<"<<s<<"> is not acceptable.\n";
flag=0;
break;
}
}
if(flag==0) continue;
if(count_vowel==0)
{
cout<<"<"<<s<<"> is not acceptable.\n";
flag=false;
}
if(flag)
{
cout<<"<"<<s<<"> is acceptable.\n";
}
}
return 0;
}
0 0
- hdu1039
- HDU1039
- hdu1039
- hdu1039
- HDU1039
- hdu1039
- HDU1039:Easier Done Than Said?
- hdu1039 java正则表达式解法
- HDU1039:Easier Done Than Said?
- HDU1039 Easier Done Than Said?
- HDU1039 Easier Done Than Said?
- HDU1039 Easier Done Than Said?
- HDU1039 Easier Done Than Said?
- HDU1039 Easier Done Than Said?(java)
- HDU1039 - Easier Done Than Said? (简单题)
- 文字跑马灯
- matlab用mex编译cpp文件
- 图片占用内存计算
- 关于mysql inner join 连接查询的优化
- 数据结构笔记(郝斌主讲)(2015-11-26 22:16:36更新完毕)
- hdu1039
- unicode编码
- JDBC五大步骤
- String()类相关
- GridView在Fragment中的使用
- 《随笔》pyqt 获取 TreeWidget 选中项的内容
- SQL Server排名或排序的函数
- POJ3292
- PHP正则匹配替换图片地址