#include <bits/stdc++.h>
using namespace std;
std::unordered_map<std::string, int> mp;
string find_word1 = "01";
string find_word2 = "10";
long long maxAns(string s, int count) {
  int max = count;
  int tmp = 0;
  std::string::size_type pos;
  if (s.size() < 2) return count;
  if (mp[s] > 0) return mp[s];
  pos = s.find(find_word1);
  while (pos != std::string::npos) {
    string reps = s;
    reps.replace(pos, find_word1.length(), "");
    tmp = maxAns(reps, count + 2);
    if (tmp > max) max = tmp;
    if (max == s.size()) return max;
    pos = s.find(find_word1, pos + find_word1.length());
  }
  pos = s.find(find_word2);
  while (pos != std::string::npos) {
    string reps = s;
    reps.replace(pos, find_word2.length(), "");
    tmp = maxAns(reps, count + 2);
    if (tmp > max) max = tmp;
    if (max == s.size()) return max;
    pos = s.find(find_word2, pos + find_word2.length());
  }
  mp[s] = max;
  return max;
}
void solve() {
  string s;
  cin >> s;
  long long count = 0;
  long long ret = maxAns(s, 0);
  std::cout << ret << std::endl;
}
int main(int argc, char *argv[]) {
  solve();
  return 0;
}
