# 2019/08/17
# AtCoder Grand Contest 037 - A

# Input
s = input()
adict = dict()

# Count
for i in range(len(s)):
    if adict.get(s[i]) == None:
        adict[s[i]] = 1
    else:
        adict[s[i]] = adict[s[i]] + 1

# Search min char
smin = 10 ** 7
for key in adict.keys():
    smin = min(smin, adict[key])

ans = len(s) - smin

# Output
print(ans)
