#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  string f = s;
  int i = 0;
  int size = 0;
  while (true) {
    bool flag = true;
    int size = s.size();
    for (int i = 0; i < size; i++) {
      if (s[i] != '1') {
        flag = false;
        break;
      }
    }
    if (flag) {
      cout << f.size() - size << endl;
      return 0;
    }
    flag = true;
    for (int i = 0; i < size; i++) {
      if (s[i] != '0') {
        flag = false;
        break;
      }
    }
    if (flag) {
      cout << f.size() - size << endl;
      return 0;
    }
    i = 0;
    while (true) {
      size = s.size();
      if (!size) break;
      if (i >= size - 1) break;
      if (s[i] == '1' && s[i + 1] == '0') {
        s.erase(i, 2);
        i = -1;
      }
      i++;
    }
    i = 0;
    while (true) {
      size = s.size();
      if (!size) break;
      if (i >= size - 1) break;
      if (s[i] == '0' && s[i + 1] == '1') {
        s.erase(i, 2);
        i = -1;
      }
      i++;
    }
  }
}
