-
-
Describe
-
Password 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.
-
-
Input
-
-
The input consists of one or more potential passwords, one per line, followed by a line containing only the word ' en d ' 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.
-
-
Output
-
For each
-
password, the output whether or isn't it is acceptable, using the precise format shown in the example.
-
-
Sample input
A TV Ptoui bontres zoggax wiinq eep houctuh End
-
Sample output
is acceptable.
is not acceptable.
is not acceptable.
is not acceptable.
is not acceptable.
is not acceptable.
is acceptable.
is acceptable.
Ideas: input data, each input a data to determine whether to accept, if there is a vowel j++;a to determine the number of consecutive vowels, b to determine the number of consecutive consonants, c to determine whether in addition to "EE" or "oo" has the same two consecutive letters, and finally determine whether the word can be accepted.
Code:
#include
#include
using namespace Std;
int main ()
{
Char a[5]= "End";
Char data[20];
while (Cin>>data)
{
if (strcmp (data,a) ==0)
return 0;
int i,j=0,a=0,b=0,c=0;
int N=strlen (data);
for (i=0;i
{
if (data[i]== ' A ' | | data[i]== ' E ' | | data[i]== ' I ' | | data[i]== ' O ' | | data[i]== ' u ')
{
j + +;
a++;
b=0;
if (data[i]==data[i+1]&&data[i]!= ' e ' &&data[i]!= ' o ')
C + +;
}
Else
{
b++;
if (data[i]==data[i+1]&&data[i]!= ' e ' &&data[i]!= ' o ')
C + +;
a=0;
}
if (a==3| | B==3)
Break
}
if (j!=0&&c==0&&a<3&&b<3)
cout<< "<" <<data<< ">" << "is acceptable." <<endl;
Else
cout<< "<" <<data<< ">" << "is not acceptable." <<endl;
}
return 0;
}
D1164:easier done Than said?