#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int GCD(int a, int b) { return b ? GCD(b, a % b) : a; }
int main() {
  string s;
  cin >> s;
  int cnt = 0;
  int n = s.size();
  for (int i = 1; i < n; ++i) {
    if (s[i - 1] != s[i]) {
      s.erase(s.begin() + i - 1, s.begin() + i + 1);
      cnt++;
      n = s.size();
      i = 0;
    }
    if (s.size() == 0) {
      cout << cnt * 2 << endl;
      exit(0);
    }
    int cnt0 = 0;
    int cnt1 = 0;
    for (int j = 0; j < s.size(); ++j) {
      if (s[j] == '0') {
        cnt0++;
      }
      if (s[j] == '1') {
        cnt1++;
      }
      if (cnt0 == s.size() || cnt1 == s.size()) {
        cout << cnt * 2 << endl;
        exit(0);
      }
    }
  }
}
