s = input()

def kaibun3(alp):
    flag1 = False

    for i in range(26):
        if flag1:
            if alp[i] % 2 == 1:
                return False
        else:
            if alp[i] % 2 == 1:
                flag1 = True

    return True

l = len(s)

a = [[0 for i in range(26)] for i in range(l+1)]

for i in range(1, l+1):
    for j in range(26):
        a[i][j] = a[i-1][j]

    ch = ord(s[i-1])-97
    a[i][ch] = a[i][ch] + 1

def test2(left, right):
    cnt = 0

    original_right = right

    while left < right:
        tmp = [a[right][i] - a[left][i] for i in range(26)]
        k = kaibun3(tmp)

        if k:
            cnt += 1
            left = right
            right = original_right + 1

        right -= 1

    return cnt

minimum = 2 * (10**5) + 1

for i in range(l):
    tmp = i + test2(i,l)
    if minimum > tmp:
        minimum = tmp

print(minimum)
