import copy

s = input()
tmp = set()
ss = []
ss.append(copy.deepcopy(tmp))
for x in s:
    if x in tmp:
        tmp.remove(x)
    else:
        tmp.add(x)
    ss.append(copy.deepcopy(tmp))
n = [0]
#print(list(ss))
for i in range(len(s)):
    n.append(0)
    n[i] = n[i-1] + 1
    for j in range(i, -1, -1):
        if n[j-1] + 1 < n[i]:
            t = set(ss[j]).symmetric_difference(set(ss[i+1]))
            if len(t) <= 1:
                n[i] = n[j-1]+1
#            print(list(t))
#            print(n)
#            print()
print(n[len(s) - 1])
