S=input()
def union(s):
    answer_str = s
    for i in range(len(s)-1):
        if s[i]!=s[i+1]:
            if i!=len(s)-2:
                return union(s[:i]+s[i+2:])
            else:
                return union(s[:i])
    
    return answer_str
 
print(len(S)-len(union(S)))

