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
<a> is acceptable.
<tv> is not acceptable.
<ptoui> is not acceptable.
<bontres> is not acceptable.
<zoggax> is not acceptable.
<wiinq> is not acceptable.
<eep> is acceptable.
<houctuh> is acceptable.
 
 #include <stdio.h>
#include <string.h> int main(){
char s[];
int length;
int i;
int flag1;
int flag2;
int flag3;
char compareString[]="aeiou"; while(){
scanf("%s",s); if(strcmp(s,"end")==)
break; length=strlen(s);
flag1=;
flag2=;
flag3=; for(i=;i<length;i++){
if(s[i]=='a' || s[i]=='e' || s[i]=='i' || s[i]=='o' || s[i]=='u')
flag1=;
} if(flag1==){
printf("<%s> is not acceptable.\n",s);
continue;
} for(i=;i<length-;i++){
if(s[i]==s[i+] && s[i]!='e' && s[i]!='o')
flag2=;
} if(flag2==){
printf("<%s> is not acceptable.\n",s);
continue;
} for(i=;i<length-;i++){
if(strchr(compareString,s[i])!=NULL && strchr(compareString,s[i+])!=NULL && strchr(compareString,s[i+])!=NULL){
flag3=;
break;
} if(strchr(compareString,s[i])==NULL && strchr(compareString,s[i+])==NULL && strchr(compareString,s[i+])==NULL){
flag3=;
break;
} } if(flag3==){
printf("<%s> is not acceptable.\n",s);
continue;
} printf("<%s> is acceptable.\n",s); }
return ;
}
 

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. HD1013Digital Roots

    Problem Description The digital root of a positive integer is found by summing the digits of the int ...

  2. FullCalendar应用——读取JSON数据

    开发者可以使用FullCalendar创建强大的日历日程应用,FullCalendar提供了丰富的选项设置和方法调用,使得开发者可以轻松的创建各种功能的日历程序.本文将结合实例使用PHP读取MySQl ...

  3. ecshop二次开发

    模板开发首页参考资料: http://book.ecmoban.com/ http://pan.baidu.com/s/1bnezFUv 自行修改ecshop读写分离设置,请查看另一篇文章,ecsho ...

  4. OC:继承、初始化方法、便利构造器

    A继承 的作用就是为了,节省代码.     继承 :子类会继承父类 里面所有的内容     思想 :凡是继承过来的实例变量和方法 都是自己的(是从父类遗传过来的)     继承的使用场景 : 当我们多 ...

  5. JavaScript 不重复的随机数

    在 JavaScript 中,一般产生的随机数会重复,但是有时我们需要不重复的随机数,如何实现?本文给于解决方法,需要的朋友可以参考下     在 JavaScript 中,一般产生的随机数会重复,但 ...

  6. Spring中使用Hibernate

    在context中定义DataSource,创建SessionFactoy,设置参数: DAO类继承HibernateDaoSupport,实现具体接口,从中获得HibernateTemplate进行 ...

  7. Angular JS 使用的注意事项

    标签中ng-app,什么情况需要指定名称,什么时候又不需要呢? 1.ng-app="" <div ng-app="" ng-controller='myC ...

  8. word2013中取消句首字母自动大写

    经常使用word的朋友都知道word中一行的首字母会自动大写,这给用户带来方便的同时,也产生了问题,因为有时候我们并不希望每行开头的首字母大写.要取消首字母自动大写可以取消勾选"首句字母大写 ...

  9. Sublime Text 2 快捷键大全

    Ctrl+L 选择整行(按住-继续选择下行) Ctrl+KK 从光标处删除至行尾 Ctrl+Shift+K 删除整行 Ctrl+Shift+D 复制光标所在整行,插入在该行之前 Ctrl+J 合并行( ...

  10. JAVA组程序优化综合考试试题

    题目原型: 有一张标准的树状结构表,里面有Structure_Id和 Parent_Id两个关键列,记录了结点的父子关系.现在要求添加一个字段为 Structure_Code ,标记为 三位一个节点关 ...