
def resolve():
    inp = input()
    orginp = inp
    while True:
        update = 0
        for i in range(len(inp)-1):
            if inp[i] != inp[i+1]:
                if len(inp) > i+1:
                    inp = inp[:i] + inp[i+2:]
                else:
                    inp = inp[:i]
                update += 1
                break
        if update == 0:
            break
    print(len(orginp)-len(inp))

resolve()