S = input()
mydict = {}
p = 1
value = 1
for j in range(len(S)):
    for i in range(len(S)):
        if len(S)<2*i+p:
            continue
        if not S[i:i+j] in mydict.keys():
            mydict[S[i:i+j]] = value
            S = S.replace(S[i:i+j],"",1).strip()
            value += 1
print(mydict)
print(len(mydict)-1)