#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string a, temp;
  cin >> a;
  temp = a;
  while (true) {
    int z = 0;
    string temp2;
    for (; z < temp.size(); z++) {
      if (z == temp.size() - 1) {
        temp2 += temp[z];
        break;
      }
      if (temp[z] == '0' && temp[z + 1] == '1') {
        z++;
      } else if (temp[z] == '1' && temp[z + 1] == '0') {
        z++;
      } else {
        temp2 += temp[z];
      }
    }
    if (temp2.size() == temp.size()) {
      cout << a.size() - temp2.size() << endl;
      break;
    }
    temp = temp2;
  }
  cin >> a;
}
