import sys;d={};i=99 for c in sys.stdin.read():a=c.isalpha();j=i-d.get(c,0)+10-11*a;print((j,c)[j>9],end='');d[c]=i;i+=a