Count the occurrences of every character in the string
for i in range ( n ) : NEW_LINE INDENT a = s [ i ] NEW_LINE if a in cnt : NEW_LINE INDENT cnt [ a ] += 1 NEW_LINE DEDENT else : NEW_LINE INDENT cnt [ a ] = 1 NEW_LINE DEDENT DEDENT