str1=input("Enter a string ") dict = {} for n in str1: key = dict.keys() if n in key: dict[n] += 1 else: dict[n] = 1 print (dict)