from collections import Counter

s = input()

def kai_judge(l):
    flag = 0
    for _, cnt in Counter(l).most_common():
        if cnt % 2 == 1:
            flag += 1
        if flag >= 2:
            return False
    else:
        return True 
        
def kaibun(l):
    for i in range(len(l), 0, -1):
        if kai_judge(l[:i]):
            return l[i:]
        
l_ans = 0
s_rest = s
while(len(s_rest) > 1):
    s_rest = kaibun(s_rest)
    l_ans += 1
    if len(s_rest) == 1:
        l_ans += 1
        break
    
r_ans = 0
s_rest = s[::-1]
while(len(s_rest) > 1):
    s_rest = kaibun(s_rest)
    r_ans += 1
    if len(s_rest) == 1:
        r_ans += 1
        break
    
print(min(l_ans, r_ans))