#include <bits/stdc++.h>
int main() {
  std::string S;
  std::cin >> S;
  std::regex r1 = std::regex("0(2*)1");
  std::regex r2 = std::regex("1(2*)0");
  std::string buf = "";
  while (S != buf) {
    buf = S;
    S = std::regex_replace(S, r2, "2$1");
    S = std::regex_replace(S, r1, "2$1");
  }
  std::cout << std::count(S.cbegin(), S.cend(), '2') * 2 << std::endl;
  return 0;
}
