#include <bits/stdc++.h>
using namespace std;
int max_ch(int a, int b) { return a < b ? b : a; }
int my_search(std::string str, int cnt, bool ch) {
  int search = ch ? '0' : '1', tgt = ch ? '1' : '0';
  int n = str.length() - 1;
  for (int i = 0; i < n; ++i) {
    if (str[i] == search) {
      int check = i + 1;
      while (str[check] == ' ') {
        ++check;
      }
      if (str[check] == tgt) {
        str[i] = ' ';
        str[check] = ' ';
        return max_ch(my_search(str, cnt + 2, true),
                      my_search(str, cnt + 2, false));
      } else {
        i = check - 1;
      }
    }
  }
  return cnt;
}
int main() {
  string str;
  cin >> str;
  int val1 = my_search(str, 0, true);
  int val2 = my_search(str, 0, false);
  cout << max_ch(val1, val2) << endl;
}
