Easier done Than said? (Hangzhou Electric oj1039)

Source: Internet
Author: User

Easier done Than said?Time limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)
Total submission (s): 8339 Accepted Submission (s): 4093


Problem Descriptionpassword security is a tricky thing. Users prefer simple passwords that is easy to remember (like Buddy), but such passwords is often insecure. Some sites use random computer-generated passwords (like Xvtpzyo), but users has a hard time remembering them and Sometim Es leave them written on notes stuck to their computer. One potential solution is to generate "pronounceable" passwords that's 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 is a Cceptable. To is 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 the consecutive occurrences of the same letter, and except for ' ee ' or ' oo '.

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

Inputthe 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 are at least one and at the most twenty letters long and consists only of lowercase letters.

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

Sample Input
Atvptouibontreszoggaxwiinqeephouctuhend

Sample Output
<a> is acceptable.<tv> are not acceptable.<ptoui> are not acceptable.<bontres> are not ACCEPTABLE.&L T;zoggax> is not acceptable.<wiinq> are not acceptable.<eep> are acceptable.

Sourcemid-central USA 2000
#include <stdio.h> #include <string.h>char s[200];int main () {int j,len,k1,k2,t,ok;while (scanf ("%s", s) &&STRCMP (S, "end")!=0) {Len=strlen (s); Ok=1,k1=0,k2=0,t=0;for (j=0;j<len;j++) {if (s[j]== ' A ' | | s[j]== ' E ' | | s[j]== ' I ' | | s[j]== ' O ' | | s[j]== ' u ') {    k1++;    k2=0;    t++;    } else{    k1=0;    k2++;    } if (k1>=3| | k2>=3)    ok=0;if (S[j+1]==s[j]) {    if (s[j]!= ' e ' &&s[j]!= ' o ')       ok=0;}} if (t==0)    printf ("<%s> is not acceptable.\n", s), and else if (ok==1)    printf ("<%s> is acceptable.\n", s ); else    printf ("<%s> is not acceptable.\n", s);} return 0;}

Easier done Than said? (Hangzhou Electric oj1039)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.