#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
unsigned long long gcd(unsigned long long a, unsigned long long b) {
  return b ? gcd(b, a % b) : a;
}
unsigned long long lcm(unsigned long long a, unsigned long long b) {
  return a / gcd(a, b) * b;
}
void func(long long S) {}
int main() {
  string s;
  cin >> s;
  int cntRed = 0;
  int cntBlue = 0;
  for (int i = s.size() - 1; i > 0; i--) {
    if (s[i] != s[i - 1]) continue;
    if (s[i] == s[i - 1] && s[i] == '1') {
      cntBlue++;
    }
    if (s[i] == s[i - 1] && s[i] == '0') {
      cntRed++;
    }
  }
  if (s.size() == 1) {
    cout << 0 << endl;
  } else {
    cout << s.size() - abs(cntBlue - cntRed) * 2 << endl;
  }
  return 0;
}
