从键盘输入一串字符to be or not to be统计每个字符出现的次数 样例输入to be or not to be
a = input() d = {} for i in a: if i in d: d[i] += 1 else: d[i] = 1 print(d)