#include <bits/stdc++.h>
using namespace std;
string s;
int countremove(string str) {
  int N = str.size();
  if (!N) return 0;
  int flag0 = 1, flag1 = 1;
  for (int i = 0; i < N; i++) {
    if (flag0 && str[i] == '1') flag0 = 0;
    if (flag1 && str[i] == '0') flag1 = 0;
  }
  if (flag0 || flag1) return 0;
  string tempstr = "";
  int count = 0;
  for (int i = 0; i < N; i += 2) {
    if (i != N - 1 && str[i] != str[i + 1]) {
      count += 2;
    } else {
      tempstr += str[i];
      i--;
    }
  }
  count += countremove(tempstr);
  return count;
}
int main() {
  cin >> s;
  printf("%d\n", countremove(s));
  return 0;
}
