Easier Done Than Said?

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 16543    Accepted Submission(s): 7846

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.
 
Source
 

代码:

 #include<stdio.h>
#include<string.h>
int main(){
char a[];
int i,num,flag,len;
int b[];
while(~scanf("%s",&a)&&strcmp("end",a)){
for(i=;i<;i++)
b[i]=;
num=;
flag=;
len=strlen(a);
for(i=;i<len;i++){
if(a[i]=='a'||a[i]=='e'||a[i]=='i'||a[i]=='o'||a[i]=='u'){
b[i]=;
num+=;
}
else
b[i]=;
}
for(i=;i<len;i++){
if(b[i]==b[i-]&&b[i-]==b[i-]){
flag=;
break;
}
}
for(i=;i<len;i++){
if(a[i]==a[i-]&&a[i]!='e'&&a[i]!='o'){
flag=;
break;
}
}
if(num==||flag==)
printf("<%s> is not acceptable.\n",a);
else
printf("<%s> is acceptable.\n",a);
}
return ;
}

最新文章

  1. C#和C实现通过CRC-16 (Modbus)获取CRC值并校验数据(代码)
  2. Selenium2学习-039-WebUI自动化实战实例-文件上传下载
  3. [转]使用Stopwatch类实现高精度计时
  4. Java 使用Redis缓存工具的图文详细方法
  5. js数据类型和关系运算语法
  6. C# 连接SQL数据库 常用连接字符串
  7. Java学习笔记25(System类)
  8. f.lux——自动调整屏幕色温减少眼睛疲劳,长时间玩电脑必备!
  9. 阿里云API网关(5)用户指南(调用 API)
  10. bzoj3309DZY Loves Math
  11. css3 resize属性
  12. HTTP/2 资料汇总
  13. 迁移svn项目到git
  14. 连接centos服务器gui
  15. 20171205xlVBA往返航班组合
  16. 关于阿里云和ucloud云服务器负载均衡器slb和ulb会话保持的配置
  17. python 怎么模拟加header(如User-Agent、Content-Type等等)
  18. javascript的实现事件的一些实例
  19. 使用Visual Studio2013打开Visual Studio2015项目
  20. HDU 2087 剪花布条(字符串匹配,KMP)

热门文章

  1. EF to linq 左连接
  2. BZOJ3673 &amp; BZOJ3674 可持续化并查集 【可持续化线段树维护可持续化数组】
  3. sqlserver数据库迁移
  4. Backup and Restore MySQL Database using mysqlhotcopy
  5. eclipse关闭错误警告提示
  6. php文件上传错误代码
  7. React 使用 fetch 请求天气
  8. 我们用CloudStack做什么
  9. 转载:Java中的String与常量池
  10. [BZOJ1151][CTSC2007]动物园zoo 解题报告|DP|位运算