Assignment

Write a function countLetters that codes a given sentence by counting how many times every letter from the alphabet occurs. The given sentence must be given as an argument to the function. The function must print a string as a result, in which all letters that occur in the sentence are alphabetically listed, each preceded by an integer that indicates the amount of times the letter occurs in the sentence. On counting the letters, no distinction should be made between uppercase and lowercase letters, and in the coded sentence, only lowercase letters occur. All characters from the given sentence that are not a letter from the alphabet (spaces, punctuation marks, …) must be ignored.

Example

>>> countLetters('Always look on the bright side of life.')
'2a1b1d3e2f1g2h3i1k3l1n4o1r2s2t1w1y'
>>> countLetters('And now for something completely different.')
'1a1c2d5e3f1g1h2i2l2m4n4o1p2r1s3t1w1y'
>>> countLetters('THIS IS AN EX-PARROT!!')
'2a1e1h2i1n1o1p2r2s2t1x'