#include <bits/stdc++.h>
const std::string str010 = "010";
const std::string str101 = "101";
const char none = '2';
int main() {
  std::string S;
  std::cin >> S;
  std::size_t n = S.size();
  int ans = 0;
  while (1) {
    bool ok = false;
    for (int i = 1; i < n - 1; i++) {
      std::string tmp = S.substr(i - 1, 3);
      if (tmp == str010) {
        if (i - 2 < 0) {
          S[i] = none;
          S[i + 1] = none;
        } else if (i + 2 >= n) {
          S[i] = none;
          S[i - 1] = none;
        } else if (S[i - 2] == S[i + 2]) {
          S[i] = none;
          S[i + 1] = none;
        } else {
          if (S[i - 2] == '0') {
            S[i] = none;
            S[i + 1] = none;
          } else {
            S[i] = none;
            S[i - 1] = none;
          }
        }
        ans++;
        ok = true;
      } else if (tmp == str101) {
        if (i - 2 < 0) {
          S[i] = none;
          S[i + 1] = none;
        } else if (i + 2 >= n) {
          S[i] = none;
          S[i - 1] = none;
        } else if (S[i - 2] == S[i + 2]) {
          S[i] = none;
          S[i + 1] = none;
        } else {
          if (S[i - 2] == '0') {
            S[i] = none;
            S[i - 1] = none;
          } else {
            S[i] = none;
            S[i + 1] = none;
          }
        }
        ans++;
        ok = true;
      }
    }
    S.erase(std::remove(S.begin(), S.end(), none), S.end());
    n = S.size();
    if (!ok) break;
  }
  while (1) {
    bool ok = false;
    for (int i = 1; i < n; i++) {
      if ((S[i] == '0' && S[i - 1] == '1') ||
          (S[i] == '1' && S[i - 1] == '0')) {
        S[i] = none;
        S[i - 1] = none;
        ans++;
        ok = true;
      }
    }
    S.erase(std::remove(S.begin(), S.end(), none), S.end());
    n = S.size();
    if (!ok) break;
  }
  std::cout << ans * 2 << std::endl;
  return 0;
}
