#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int a, b, k, c1, c2, maxi;
void solve() {
  string s;
  cin >> s;
  int len = s.size();
  queue<char> q;
  q.push(s[0]);
  for (int i = 1; i < len; i++) {
    char yo = q.front();
    if (s[i] == '0' && yo == '1' || s[i] == '1' && yo == '0') {
      if (!q.empty()) {
        q.pop();
        c1 += 2;
      }
    } else
      q.push(s[i]);
  }
  stack<char> st;
  st.push(s[len - 1]);
  char yo;
  for (int i = len - 2; i >= 0; i--) {
    if (!st.empty()) yo = st.top();
    if (s[i] == '0' && yo == '1' || s[i] == '1' && yo == '0') {
      if (!st.empty()) {
        st.pop();
        c2 += 2;
      }
    } else
      st.push(s[i]);
  }
  maxi = max(c1, c2);
  cout << maxi;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int t = 1;
  while (t--) solve();
  return 0;
}
