N = input()
count = 0
p = 0
q = 1
ng_list = []
for i in range(len(N) - 1):
  if i in ng_list:
    continue
  if N[i] == N[i + 1]:
    count += 2
    ng_list.append(q)
    q += 1
    while N[p] == N[q]:
      count += 1
      ng_list.append(q)
      q += 1
      if q == len(N):
        break
  else:
    p += 1
    q += 1

print(count)