import collections
i,j = 0,0 
q = collections.deque([])
while(j < len(s)):
  while(s[j] == s[i]): j+=1
  q.append(j - i - 1)
  j = i

5 6 5 1 1 4 2 1 1 1 1 1

while(len(q) > 1):
  u,v = q.popleft(), q.popleft()
  if q: q[0] += abs(u-v)
print q[0] if q else 0