S = list(input())
N = len(S)
while(1):
    Q = []
    for i in range(len(S)-1):
        if S[i]!=S[i+1]:
            i += 1
        else:
            Q.append(S[i])
    Q.append(S[-1])
    if S == Q:
        break
    S = Q 
    #print(S)
print(N-len(S))
    
