#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, i, j, k, l, c, flag;
  string s1, s2;
  stack<char> st;
  char x;
  cin >> s1;
  flag = 1;
  c = 0;
  s2 = "";
  for (i = 0; i < s1.size(); i++) {
    if (s1[i] == '0' && s1[i + 1] == '1') {
      c++;
      i++;
    } else if (s1[i] == '1' && s1[i + 1] == '0') {
      c++;
      i++;
    } else if (s1[i] == '0' && s1[i + 1] == '0' ||
               s1[i] == '1' && s1[i] == '1') {
      if (!st.empty()) {
        x = st.top();
        if (x != s1[i]) {
          c++;
          st.pop();
        } else if (x == s1[i]) {
          st.push(s1[i]);
        }
      } else if (st.empty()) {
        st.push(s1[i]);
      }
    }
  }
  c *= 2;
  cout << c << endl;
  return 0;
}
