#include <bits/stdc++.h>
using namespace std;
string s;
stack<int> arr;
stack<int> h;
int cnt = 0;
int main() {
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    arr.push(s[i] - '0');
  }
  while (true) {
    bool check = false;
    bool cal = false;
    while (!arr.empty()) {
      int a = arr.top();
      arr.pop();
      if (arr.empty()) {
        h.push(a);
        continue;
      }
      int b = arr.top();
      arr.pop();
      if (a + b == 1) {
        cnt += 2;
        check = true;
        if (!cal && !h.empty()) h.pop();
        cal = true;
      } else {
        h.push(a);
        h.push(b);
        arr.push(b);
        cal = false;
      }
    }
    if (!check) break;
    while (!h.empty()) {
      arr.push(h.top());
      h.pop();
    }
    if (arr.empty()) break;
  }
  cout << cnt << endl;
}
