-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathe3136.c
39 lines (34 loc) · 803 Bytes
/
e3136.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
bool isValid(char* word) {
bool cons = false;
bool vow = false;
int len = 0;
while (*word) {
len++;
if (*word >= 65 && *word <= 90) {
*word += 32;
}
// letter
if (*word >= 97 && *word <= 122) {
switch (*word) {
case 'a' :
case 'e' :
case 'i' :
case 'o' :
case 'u' :
vow = true;
break;
default :
cons = true;
break;
}
word++;
continue;
}
if (*word >= 48 && *word <= 57) {
word++;
continue;
}
return false;
}
return cons && vow && (len >= 3);
}