Easier Done Than Said?

来源:互联网 发布:linux apache启动命令 编辑:程序博客网 时间:2024/05/22 22:36

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

atvptouibontreszoggaxwiinqeephouctuhend
 

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.

 

这个题要满足三个条件即可

1.必须存在一个元音 2.不可有连续3个元音或者是辅音(我是想也就是说每三个元音和辅音都要大于1) 3.相邻的不可以相等

 

#include <stdio.h>#include <stdlib.h>#include<string.h>int main(){    char str[40];    int n,m,i,j;    while(gets(str)!=NULL)    {        int a=0,b=0,c=0,s=0,flag,flag1,flag2;        if(strcmp(str,"end")==0) break;        n=strlen(str);        for(i=0; i<n; i++)        {            if(str[i]=='a') ++s;            if(str[i]=='e') ++s;            if(str[i]=='i') ++s;            if(str[i]=='o') ++s;            if(str[i]=='u') ++s;        }        if(s>=1) flag=1;        else flag=0;        if(n==1||n==2) flag1=1;        else        {            for(i=0; i<n-2; i++)            {                int x=0,y=0;                for(j=i; j<i+3; j++)                {                    if(str[j]=='a'||str[j]=='i'||str[j]=='e'||str[j]=='o'||str[j]=='u')                        ++x;                    if(str[j]!='a'&&str[j]!='i'&&str[j]!='e'&&str[j]!='o'&&str[j]!='u')                        ++y;                }                if(x>=1&&y>=1) ++b;            }            if(b==n-2) flag1=1;            else flag1=0;        }        if(n==1) flag2=1;        else        {            for(i=0; i<n-1; i++)            {                if(str[i]!=str[i+1]||str[i]=='e'||str[i]=='o') ++c;            }            if(c==n-1) flag2=1;            else flag=0;        }        if(flag==1&&flag1==1&&flag2==1) printf("<%s> is acceptable.\n",str);        else printf("<%s> is not acceptable.\n",str);    }    return 0;}


 

0 0
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 手机不能向下拉怎么办 cad运行不了插件怎么办 ai中缺少文字怎么办 电脑被格式化了怎么办 迷你世界地图下载失败怎么办 网页上广告太多怎么办 网页打开广告太多怎么办 PS界面图标小怎么办 百度地图反应慢怎么办 汽车导航不播报怎么办 wps菜单栏隐藏了怎么办 手机导航声音小怎么办 手机导航不好用怎么办 手机导航箭头不准怎么办 手机处于离线状态怎么办 穷人让人看不起怎么办 非洲人口过多怎么办啊 鼻子上长白头怎么办 高铁查到违禁品怎么办 青岛涂料备案证怎么办 淘宝集运不能寄怎么办 防静电指数过高怎么办 手机玻璃上裂痕怎么办 车辆环保检测不合格怎么办 眼镜被擦破镜片怎么办 手机边框有刮痕怎么办 手机金属壳磨损怎么办 手机后面凹下去怎么办 pu鞋子有刮痕怎么办 漆皮皮鞋有刮痕怎么办 手机有屏幕刮痕怎么办 鞋子刮花了怎么办 手机上屏幕划痕怎么办 篮球鞋磨小脚趾怎么办 小白鞋边上蹭黑怎么办 行李忘在高铁上怎么办 新加坡东西掉了怎么办 怕空调怕风吹怎么办 夏天不能吹空调怎么办 mac忘了用户名怎么办 物流托运货物损坏怎么办