s = input()

L = [[0]*26]
for c in s:
    LL = L[-1].copy()
    LL[ord(c)-97] += 1
    L.append(LL)

def solve(left, right):
    cnt = 0
    U = set()
    res = 0
    for i, (b, a) in enumerate(zip(L[right], L[left])):
        if b-a == 1:
            U.add(i)
    f = 0
    l = left
    for i in range(left, right):
        if ord(s[i])-97 in U:
            f += 1
        else:
            if f >= 2:
                res += solve(l, i-f)
                res += f
                l = i
            f = 0
    if l != left:
        res += solve(l, right)
    else:
        for b, a in zip(L[right], L[left]):
            if (b - a) % 2 == 1:
                res += 1
    return res

print(max(solve(0, len(s)),1))
