Vowel Consonant Other
Python
Easy
2 views
Problem Description
One character ch is provided. Output VOWEL if it is a vowel (a,e,i,o,u in any case), CONSONANT if it is an English letter but not vowel, else output OTHER.
Input Format
One character (may be a letter/digit/symbol).
Output Format
VOWEL or CONSONANT or OTHER.
Constraints
Input length is at least 1.
Official Solution
import sys
s=sys.stdin.read()
if not s: sys.exit(0)
ch=s.strip()[:1]
if not ch:
sys.exit(0)
vow=set('aeiouAEIOU')
if ch in vow:
sys.stdout.write('VOWEL')
elif ('A'<=ch<='Z') or ('a'<=ch<='z'):
sys.stdout.write('CONSONANT')
else:
sys.stdout.write('OTHER')
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!