#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 1e9;
int main() {
  string S;
  cin >> S;
  int ans1 = 0;
  int N = S.size();
  int cnt0 = 0, cnt1 = 0;
  for (int i = 0; i < int(N); ++i) {
    if (S[i] == '0')
      cnt0++;
    else
      cnt1++;
    if (cnt0 == cnt1) ans1 = cnt0 * 2;
  }
  int ans2 = 0;
  cnt0 = 0, cnt1 = 0;
  for (int i = 0; i < int(N); ++i) {
    int j = N - 1 - i;
    if (S[j] == '0')
      cnt0++;
    else
      cnt1++;
    if (cnt0 == cnt1) ans2 = cnt0 * 2;
  }
  cout << max(ans1, ans2) << endl;
}
