import re

S = input()
xs = list(S)

i, j = 0, 1
while j < len(xs):
    if xs[i] != xs[j]:
        xs[i:j + 1] = []
        i -= 1
        j = i + 1
    else:
        i += 1
        j += 1
print(len(S) - len(xs))
