码迷,mamicode.com
首页 > 其他好文 > 详细

hdu1039

时间:2015-08-21 13:36:23      阅读:150      评论:0      收藏:0      [点我收藏+]

标签:acm hdu c++

#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;
}

版权声明:本文为博主原创文章,未经博主允许不得转载。

hdu1039

标签:acm hdu c++

原文地址:http://blog.csdn.net/linxingqianglai/article/details/47832839

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!