S = str(input())
T = S
flag = True
while(flag):
    flag = False
    for i in range(1, len(T)):
        if int(T[i-1]) ^ int(T[i]):
            flag = True
            T = T[:i-1]+T[i+1:]
            break
print(len(S)-len(T))
