s=input()
flag=1
length=len(s)
while flag:
    l=len(s)
    if l<=1:
        break
    for i in range(1,l):
        if s[i-1]!=s[i]:
            s=s[:i-1]+s[i+1:]
            break
        elif i==l-1:
            flag=0
print(length-len(s))