A drone racing league lets every pilot choose a callsign for the leaderboard, but the registration system enforces a strict format so that callsigns stay readable over a noisy radio channel. A proposed callsign S is accepted if and only if all of the following hold:
0-9, and the three radio-safe symbols @, #, and $ - no other character (including spaces or punctuation) may appear.a, e, i, o, u, in either case.Given a proposed callsign, determine whether the league's registration system accepts it.
A single line containing the proposed callsign S.
Print VALID if S is accepted by the registration system, otherwise print INVALID.
1 <= |S| <= 50S consists of printable, non-whitespace ASCII characters (it may include characters outside the allowed set, in which case it must be rejected).Example 1
Input
Ap3x#1
Expected
VALID
Explanation
The callsign is 6 characters long, every character is an English letter, a digit, or one of '@#$', it contains the vowel 'A', and it contains the consonants 'p' and 'x'. All four rules pass, so it is VALID.
Example 2
Input
Zzz99$
Expected
INVALID
Explanation
The callsign is long enough and uses only allowed characters, but every letter in it ('Z', 'z', 'z') is a consonant and none of a/e/i/o/u appears anywhere. Because it has no vowel, rule 3 fails, so it is INVALID even though every other rule is satisfied.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →