my question here
Define a function that takes a string and replaces each character with a string of the number of times that letter occurs in the word.
'Hello' -> '11221'
Ignore capitalization, so if a word has an 'H' and an 'h' the count would be more than 1.
Define a function that takes a string and replaces each character with a string of the number of times that letter occurs in the word.
'Hello' -> '11221'
Ignore capitalization, so if a word has an 'H' and an 'h' the count would be more than 1.
import collections a = 'Hello' letters = collections.Counter(a.lower()) dict(letters)