from collections import Counter
from string import ascii_lowercase
from functools import lru_cache
import sys
s = input()
sys.setrecursionlimit(100000000)

@lru_cache(maxsize=-1)
def solve(S):
    if len(S)==1:
        return 1
    if len(S)==0:
        return 0
    tmp_c = Counter(S)
    sum_val =sum(tmp_c[s_tmp]%2 for s_tmp in ascii_lowercase)
    if sum_val<=1:
        return 1
    if sum_val==2:
        return 2
    res = len(S)
    counter = Counter()
    for i,val_s in enumerate(S):
        counter[val_s]+=1
        if sum(counter[s_tmp]%2 for s_tmp in ascii_lowercase)==1:
             res= min(res,1+ solve(S[i+1:][::-1]))
    return res


print(solve(s))