Problem Description

  Password security is a tricky thing. Users prefer simple passwords that are easy to remember (like buddy), but such passwords are often insecure. Some sites use random computer-generated passwords (like xvtpzyo), but users have a hard time remembering them and sometimes leave them written on notes stuck to their computer. One potential solution is to generate "pronounceable" passwords that are relatively secure but still easy to remember.

FnordCom is developing such a password generator. You work in the quality control department, and it's your job to test the generator and make sure that the passwords are acceptable. To be acceptable, a password must satisfy these three rules:

It must contain at least one vowel.

It cannot contain three consecutive vowels or three consecutive consonants.

It cannot contain two consecutive occurrences of the same letter, except for 'ee' or 'oo'.

(For the purposes of this problem, the vowels are 'a', 'e', 'i', 'o', and 'u'; all other letters are consonants.) Note that these rules are not perfect; there are many common/pronounceable words that are not acceptable.

  
Input

  The input consists of one or more potential passwords, one per line, followed by a line containing only the word 'end' that signals the end of the file. Each password is at least one and at most twenty letters long and consists only of lowercase letters.

  
Output

  For each password, output whether or not it is acceptable, using the precise format shown in the example.

  
Sample Input


a
tv
ptoui
bontres
zoggax
wiinq
eep
houctuh
end

  
Sample Output

 
Code:
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <ctype.h> using namespace std; int judge(char a)
{
if(a=='a'||a=='e'||a=='i'||a=='o'||a=='u')
return ;
return ;
} int main()
{
char word[]; while(scanf("%s",word)!=EOF&&strcmp(word,"end"))
{
int l=strlen(word),i,flag=; for(i=;i<l;i++)
{
if(judge(word[i]))
flag=;
}
if(flag==)
{
for(i=;i<l-;i++)
{
if(word[i]==word[i+]&&word[i]!='e'&&word[i]!='o')
{
flag=;
}
} if(flag==)
printf("<%s> is not acceptable.\n",word);
else
{
for(i=;i<l-;i++)
{
if((judge(word[i])&&judge(word[i+])&&judge(word[i+]))||(!judge(word[i])&&!judge(word[i+])&&!judge(word[i+])))
{
flag=;
}
}
if(flag==)
printf("<%s> is not acceptable.\n",word);
else
printf("<%s> is acceptable.\n",word);
}
}
else
printf("<%s> is not acceptable.\n",word);
}
return ;
}

HDU1039 Easier Done Than Said?的更多相关文章

  1. HBase官方文档

    HBase官方文档 目录 序 1. 入门 1.1. 介绍 1.2. 快速开始 2. Apache HBase (TM)配置 2.1. 基础条件 2.2. HBase 运行模式: 独立和分布式 2.3. ...

  2. hdu 1039 Easier Done Than Said? 字符串

    Easier Done Than Said?                                                                     Time Limi ...

  3. ural 1356. Something Easier(数论,哥德巴赫猜想)

    1356. Something Easier Time limit: 1.0 secondMemory limit: 64 MB “How do physicists define prime num ...

  4. (转)Is attacking machine learning easier than defending it?

    转自:http://www.cleverhans.io/security/privacy/ml/2017/02/15/why-attacking-machine-learning-is-easier- ...

  5. HDU 1039.Easier Done Than Said?-条件判断字符串

    Easier Done Than Said? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/O ...

  6. 1658: Easier Done Than Said?

    1658: Easier Done Than Said? Time Limit: 1 Sec  Memory Limit: 64 MBSubmit: 15  Solved: 12[Submit][St ...

  7. HDU 1039.Easier Done Than Said?【字符串处理】【8月24】

    Easier Done Than Said? Problem Description Password security is a tricky thing. Users prefer simple ...

  8. 使 Excel 规则更容易理解(Oracle Policy Modeling-Make your Excel rules easier to understand)

    有以下几种方法可以使 Excel 规则更容易理解. 在 Excel 工作簿中缩短属性名称 您可以使用图例关键字创建在 Excel 中引用属性的缩写方式.可以根据情况指定此缩写形式. 要指定图例关键字, ...

  9. HDU 2671 Can't be easier(数学题,点关于直线对称)

    题目 //数学题//直线 y = k * x + b//直线 ax+by+c=0; 点 (x0,y0); 点到直线距离 d = (ax0+by0+c)/sqrt(a^2+b^2) /********* ...

随机推荐

  1. 什么是Web Worker?

    简单点说,Web Worker就是一个运行在后台的JavaScript线程,不会影响页面的响应. 我们知道,JavaScript是单线程的脚本语言,即同一时刻只能做一件事情,否则会带来极其复杂的同步问 ...

  2. Java基础学习之线程

    1.尽量避免直接使用 同步.Thread等原生操作线程的类,可以通过java.util.concurrent下对底层包装好的类进行操作, ReentrantLock:lock trylock  unl ...

  3. html中p标签行间距的问题

    使用CSS行高样式line-height可以设置调整p行间距,但是同时会影响每行文字间的上下间距,所以使用line-height虽然可以用来设置html p 行距离间隔,但是不是很实用,一般line- ...

  4. memcached可视化客户端工具

    TreeNMS是一款redis,Memcache可视化客户端工具,采用JAVA开发,实现基于WEB方式对Redis, Memcached数据库进行管理.维护. 功能包括:NoSQL数据库的展示,库表的 ...

  5. oracle学习笔记(2)-基本术语

    oracle基本术语 先上图. 相当粗糙的一个图,可能有些地方不够精细,大致结构基本是对的. 逻辑结构上从大到小的依次为文件(file)->表空间(tablespace)->段(segme ...

  6. 我的学习之路_第二十章_JDBC

    JDBC 使用JDBC技术,通过mysql提供的驱动程序,操作数据库 ● 1. 注册驱动 告知jvm 使用的是什么驱动程序(mysql,oracle) 使用API中的类 DriverManager中的 ...

  7. hibernate 返回对象指定属性,需要返回的列,可以直接返回 对象属性

    // hibernate 返回对象指定属性,需要返回的列,可以直接返回 对象属性 @Override public TeamPlan getTeamPlanByBaoMingId(String bao ...

  8. Vue和Bootstrap的整合之路

    我是一个刚刚接触前端开发的新手,所以有必要记录如何将Bootstrap和Vue进行整合. 如果你是老手,请直接绕道而过.作为一个新手,里面的步骤,过程或者专业术语未必正确,如果你发现哪里错误了,请发邮 ...

  9. Visual Studio Debugger中七个鲜为人知的小功能

    Visual Studio debugger是一个很棒的调试工具,可以帮助程序猿们快速地发现和解决问题.这里给大家简单介绍一下VS调试工具中的七个鲜为人知的小功能. 1.    一键跳转到指定语句 调 ...

  10. container_of 的用法

    1.问题:如何通过结构中的某个变量获取结构本身的指针???关于container_of见kernel.h中:/*** container_of - cast a member of a structu ...