#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, ans = 0, flg = 1;
  string s;
  cin >> s;
  vector<int> a(s.length());
  for (i = 0; i < s.length(); ++i) {
    if (s[i] == '1')
      a.at(i) = 1;
    else
      a.at(i) = 0;
  }
  while (flg) {
    if (a.size() == 0) break;
    flg = 0;
    vector<int> d(a.size());
    for (i = 0; i < a.size() - 1; ++i) {
      if (a.at(i) != a.at(i + 1)) {
        flg = 1;
        ans += 2;
        d.at(i) = 1;
        d.at(i + 1) = 1;
        i = i + 1;
      }
    }
    vector<int> b;
    for (i = 0; i < a.size(); ++i) {
      if (d.at(i)) continue;
      b.push_back(a.at(i));
    }
    a = b;
  }
  cout << ans << endl;
  return 0;
}
