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. angular嵌入注入服务实例

    <!DOCTYPE html> <html lang="en" ng-app="myapp"> <head> <met ...

  2. Java NIO学习笔记七 Non-blocking Server

    Java NIO:Non-blocking Server 即使你了解了Java NIO非阻塞功能的工作(怎么样Selector,Channel, Buffer等等),设计一个无阻塞服务器仍然很难.非阻 ...

  3. Java学习笔记--异常描述

    异常描述 1.简介 为了全面了解"异常"的概念,先来分析一个实例.假定要编写一个Java程序,该程序读取用户输入的一行文本,并在终端显示该文本.这里是一个演示Java语言I/O功能 ...

  4. 原始js调用 选中事件

    curRadio.get(0).checked=true;//原始js调用 选中事件,curRadio是radio单个对象

  5. SOD开源框架MSF(消息服务框架)介绍

    前言:之前想做消息的广播,拖着就忘记了,现在拿了医生的框架来学习,就按实现了之前想实现的功能. 传送门http://www.cnblogs.com/bluedoctor/,框架的获取,按传送门的链接就 ...

  6. Spring的JDBC(非web程序)的简单例子

    第一步: spring配置applicationContext.xml文件,放在src下面: <?xml version="1.0" encoding="UTF-8 ...

  7. javascript字符串属性及常用方法总结

    length属性:str.length; 常用方法: 1.  str.charAt(n) 查找字符串中的第n个字符,如果不在0~str.length-1之间,则返回一个空字符串 2  .str.ind ...

  8. easyui框架--基础篇(一)-->数据表格datagrid(php与mysql交互)

      前  言  php  easyui框架--本篇学习主要是 easyui中的datagrid(数据表格)框架. 本篇学习主要通过讲解一段代码加GIF图片学习datagrid(数据表格)中的一些常用属 ...

  9. 静态变量和Session

    静态变量: Application级别的,不同客户端访问同一个变量. Session:对于每个访问的客户端是独立的,都有一个唯一的SessionID.也就是说,不同客户端下,都可以有一个Session ...

  10. Docker-compose 多个Docker容器管理:以MYSQL和Wordpress为例

    搬砖的陈大师版权所有,转载请注明:http://www.lenggirl.com/tool/docker-compose.html Docker-compose 多个Docker容器管理:以MYSQL ...