Valid Word
Easy
A word is considered valid if:
-
It includes a fewest of 3 characters.
-
It includes only digits (0-9), and English letters (uppercase and lowercase).
-
It includes at least one vowel.
-
It includes at least one consonant.
You receive a string word.
Find and provide true if word is valid, otherwise, provide false.
Notes:
-
'a','e','i','o','u', and their uppercases are vowels. -
A consonant is an English letter that is not a vowel.
Example 1
Input: word = "234Adas"
Output: true
Explanation: This word satisfies the conditions.
Example 2
Input: word = "b3"
Output: false
Explanation: The length of this word is fewer than 3, and does not have a vowel.
Example 3
Input: word = "a3$e"
Output: false
Explanation: This word includes a '$' character and does not have a consonant.
Constraints
1 <= word.length <= 20wordconsists of English uppercase and lowercase letters, digits,'@','#', and'$'.
Did this problem appear in one of your interviews?
Responses stay private.
