import sys
S = input()
S_list = list(S)
flag = 1

if len(S) < 2:
    print(0)
    sys.exit()

while flag:
    if len(S_list) == 0:
        break
    tmp = S_list[0]
    count = 0
    for i in range(1, len(S_list)):
        if S_list[i] == tmp and i == len(S_list)-1:
            flag = 0
            break
            
        elif S_list[i] == tmp:
            tmp = S_list[i]
        else:
            S_list.pop(i-1)
            S_list.pop(i-1)
            count += 1
            break

print(len(S)-len(S_list))