#C14321. Sort and Count Vowels
Sort and Count Vowels
Sort and Count Vowels
You are given a string s. Your task is to sort the string in alphabetical order and count the occurrences of each vowel in the sorted string. The vowels to be counted are a, e, i, o, u. Both uppercase and lowercase letters should be considered as the same letter (i.e. 'A' is equivalent to 'a').
In other words, if you denote the input string as \( s \), you need to perform the following steps:
- Convert \( s \) to all lowercase.
- Sort the characters of \( s \) in non-decreasing (alphabetical) order.
- Count the number of occurrences of each vowel: \(a, e, i, o, u\).
Finally, output the counts in the following format exactly:
{'a': count_a, 'e': count_e, 'i': count_i, 'o': count_o, 'u': count_u}
inputFormat
The input contains a single string s read from standard input (stdin). The string may include spaces, punctuation, and other characters.
outputFormat
Print to standard output (stdout) a dictionary-like string showing the count of each vowel in the sorted string. The output should follow exactly the format:
{'a': count_a, 'e': count_e, 'i': count_i, 'o': count_o, 'u': count_u}## sample
Hello World!
{'a': 0, 'e': 1, 'i': 0, 'o': 2, 'u': 0}