Write a programExercise 3/4Elementary20 XP

Words by their first letter

Task

The program reads a sentence of lower-case letters without accents and groups its words by their first letter. For each first letter (sorted alphabetically) it prints a line letter: words, with the words in their order in the sentence, separated by spaces.

For the sentence auto bicykel autobus vlak bager the program prints:

a: auto autobus
b: bicykel bager
v: vlak

Examples

  • Input

    auto bicykel autobus vlak bager

    Expected output

    a: auto autobus
    b: bicykel bager
    v: vlak

After you submit, 4 hidden tests will also check your solution: one word, all with the same letter, repeated words, letters out of order.

Python starts the first time you run code.

Ctrl+Enter runs the program. Tab indents. Press Esc, then Tab, to leave the editor.

Input (stdin)

Each line = one call to input().

Output

Hints

Try it yourself first. Each hint reveals a little more - and lowers the reward a little.

Signed out, hints are free - but no XP is awarded either.

Solution

The solution unlocks after the last hint.