#include <bits/stdc++.h>
using namespace std;
int find(string& s, int n, int i, int left, int want_right) {
  for (int j = i + 1; j < n; ++j) {
    if (s[j] == 'x') continue;
    if (s[j] == want_right) {
      s[i] = 'x';
      s[j] = 'x';
      return 2;
    } else if (s[j] == left) {
      break;
    }
  }
  return 0;
}
int main() {
  string s;
  cin >> s;
  const int n = s.size();
  int ans = 0;
  bool found = false;
  while (true) {
    found = false;
    for (int i = 0; i < n - 1; ++i) {
      if (s[i] == 'x') continue;
      if ((s[i] == '0' && s[i + 1] == '1') ||
          (s[i] == '1' && s[i + 1] == '0')) {
        ans += 2;
        s[i] = 'x';
        s[i + 1] = 'x';
        found = true;
        continue;
      }
      if (s[i] == '0' && s[i + 1] == 'x') {
        auto r = find(s, n, i, '0', '1');
        if (r > 0) {
          ans += r;
          found = true;
        }
      }
      if (s[i] == '1' && s[i + 1] == 'x') {
        auto r = find(s, n, i, '1', '0');
        if (r > 0) {
          ans += r;
          found = true;
        }
      }
    }
    if (!found) break;
  }
  cout << ans << endl;
  return 0;
}
