#include <bits/stdc++.h>
#pragma warning(disable : 4996)
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC diagnostic ignored "-Wwrite-strings"
int main() {
  char sInput[100000 + 1] = "";
  char* psInput = NULL;
  int i = 0;
  int j = 0;
  int nLen = 0;
  int nBlocks = 0;
  int nTargetIsEven = 0;
  int nRemoves = 0;
  gets(sInput);
  nLen = strlen(sInput);
  nBlocks = nLen / 2;
  nTargetIsEven = nLen % 2;
  if (nBlocks > 0) {
    for (i = 0; i < nBlocks; i++) {
      if ((sInput[i * 2] == '0' && sInput[i * 2 + 1] == '1') ||
          (sInput[i * 2] == '1' && sInput[i * 2 + 1] == '0')) {
        sInput[i * 2] = ' ';
        sInput[i * 2 + 1] = ' ';
        nRemoves = nRemoves + 2;
      } else if (i < nBlocks - 1 || nTargetIsEven) {
        if ((sInput[i * 2 + 1] == '0' && sInput[i * 2 + 2] == '1') ||
            (sInput[i * 2 + 1] == '1' && sInput[i * 2 + 2] == '0')) {
          sInput[i * 2 + 2] = sInput[i * 2];
          sInput[i * 2] = ' ';
          sInput[i * 2 + 1] = ' ';
          nRemoves = nRemoves + 2;
        }
      }
    }
  }
  printf("%d\n", nRemoves);
  return 0;
}
