S = input()
def co(s):
    l = list(s)
    cnt = True
    for i in range(len(s))[:0:-1]:
        if l[i] != l[i-1]:
            del l[i]
            del l[i-1]
            cnt = False
            break
    if cnt:
        return s
    if not cnt:
        return co(''.join(l))
print(len(S)-len(co(S)))