#include <bits/stdc++.h>
using namespace std;
map<string, int> reduce_memo{
    {"", 0},
    {"1", 0},
    {"0", 0},
};
int reduce(const string str) {
  if (reduce_memo.count(str) > 0) {
    return reduce_memo[str];
  }
  set<string> calced;
  int max_index = -1;
  int max_result = -1;
  for (int last_index = 0;;) {
    int index = str.find("01", last_index);
    if (index == string::npos) break;
    last_index = index + 1;
    string tmp(str);
    tmp.replace(index, 2, "");
    if (calced.count(tmp) > 0) {
      continue;
    }
    calced.insert(tmp);
    auto result = reduce(tmp) + 2;
    if (max_result < result) {
      max_index = index;
      max_result = result;
    }
  }
  for (int last_index = 0;;) {
    int index = str.find("10", last_index);
    if (index == string::npos) break;
    last_index = index + 1;
    string tmp(str);
    tmp.replace(index, 2, "");
    if (calced.count(tmp) > 0) {
      continue;
    }
    calced.insert(tmp);
    auto result = reduce(tmp) + 2;
    if (max_result < result) {
      max_index = index;
      max_result = result;
    }
  }
  if (max_index < 0) {
    return 0;
  }
  reduce_memo[str] = max_result;
  return max_result;
}
int main(void) {
  string str;
  cin >> str;
  auto result = reduce(str);
  cout << result << endl;
  return 0;
}
