import sys

s = input()

last = [-1] * (len(s)+2)

dic = {}
alp = "abcdefghijklmnopqrstuvwxyz"
for i in alp:
    dic[i] = 0

for i in range(len(s)):

    dic[s[i]] ^= 1

    ns = 0
    for j in dic:
        ns += dic[j]

    last[ns] = i

for i in range(len(s)+1):

    if last[i+1] < last[i]:
        print (max(1,i))
        sys.exit()


