Write a programExercise 2/4Elementary20 XP

Letter counts

Task

The program reads a sentence (only letters without accents, spaces and punctuation) and for every letter in it prints a line letter: count. Upper and lower case count as the same letter (print lower case); characters that are not letters are ignored. Sort the lines alphabetically.

For the sentence Ahoj ahoj! the program prints:

a: 2
h: 2
j: 2
o: 2

Examples

  • Input

    Ahoj ahoj!

    Expected output

    a: 2
    h: 2
    j: 2
    o: 2

After you submit, 4 hidden tests will also check your solution: upper and lower case, with digits, a longer sentence, an empty sentence.

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.