A word is valid if it has at least 3 characters, contains only digits and English letters, includes at least one vowel, and includes at least one consonant. Vowels are `a`, `e`, `i`, `o`, `u` in either case; a consonant is any other English letter. Given a string `word`, return `true` if it is valid, otherwise `false`.
A word is valid if it has at least 3 characters, contains only digits and English letters, includes at least one vowel, and includes at least one consonant. Vowels are a, e, i, o, u in either case; a consonant is any other English letter. Given a string word, return true if it is valid, otherwise false.
Example 1:
Input: {"word":"234Adas"}
Output: true
Constraints:
1≤word.length≤20
word consists of English uppercase and lowercase letters, digits, '@', '#', and '$'.
Test Cases
Input (Stdin)
Expected Output (Stdout)
Execution Result
Run code to see results.
Input
arr ={"word":"234Adas"}
word
length 7
2
0
3
1
4
2
A
3
d
4
a
5
s
6
vowels (0)
consonants (0)
digits (0)
?
length ≥ 3
?
letters and digits only
?
has a vowel
?
has a consonant
"234Adas" must pass four rules: length, allowed characters, a vowel, and a consonant.