Solution: count characters



examples/dictionary/count_characters.py
text = """
This is a very long text.
OK, maybe it is not that long after all.
"""

# print(text)
count = {}

for char in text:
    if char == '\n':
        continue
    if char not in count:
        count[char] = 1
    else:
        count[char] += 1

for key in sorted( count.keys() ):
    print("'{}' {}".format(key, count[key]))

{
    "a": 2,
    "b": 1,
    "x": 1,
}