usr_input = input()
lst=[]
for element in usr_input:
    lst.append(element)

n = len(lst)
remainder = n
counter =0

while(remainder != 0):
    new_counter = 0
    for num in range(0,remainder-1,1):
        if lst[num]== lst[num+1]:
            lst.remove(lst[num])
            new_counter += 1
            lst.remove(lst[num])
            new_counter += 1
            lst.insert(num,'a')
            lst.insert(num,'b')
    counter += new_counter
    if new_counter >0:
        lst.remove('a')
        lst.remove('b')
    if len(lst)==remainder:
        remainder = 0
    else:
        remainder = len(lst)

print(counter)   