s = input()
n = len(s)
flag = True
while(flag):
    for i in range(len(s)-1):
        if s[i]!=s[i+1]:
            s = s[:i]+s[i+2:len(s)]
            break
    else:
        flag=False
print(n-len(s))