input replace split upper for in get sorted items key lambda reverse T

1
2
3
4
5
6
7
8
n = input().replace(' ','').split('.')[0].upper()
a = {}
for i in n :
a[i] = a.get(i,0)+1
a = sorted(a.items(), key = lambda x: x[1], reverse = True)
t = [i for i in a if i[1] == a[0][1]]
t = sorted(t)
print(t[0][0],t[0][1])