a=input()
x1=x2=""
for i in range(97,97+26+1):
    s=chr(i)
    n=a.count(s)
    if n>0:
        x1=x1+s
        x2=x2+str(n)
print(x1)
print(x2)
/**************************************************************
	Problem: 1177
	User: admin
	Language: Python
	Result: Accepted
	Time:94 ms
	Memory:34480 kb
****************************************************************/