LearnPy Hub
← Modules & the Standard Library problems
Medium

Group Words

Read words and group them by their first letter using collections.defaultdict(list). Print each letter (alphabetical) and its words.

Input

One line of words.

Output

One line per letter.

Sample 1

Input
apple avocado banana blueberry cherry
Output
a apple avocado
b banana blueberry
c cherry

Sample 2

Input
x
Output
x x
solution.py
Output appears here
Group Words · Python practice problem · LearnPy Hub