#include <bits/stdc++.h>
using namespace std;
std::string ReplaceString(std::string String1, std::string String2,
                          std::string String3) {
  std::string::size_type Pos(String1.find(String2));
  while (Pos != std::string::npos) {
    String1.replace(Pos, String2.length(), String3);
    Pos = String1.find(String2, Pos + String3.length());
  }
  return String1;
}
int main() {
  string str;
  cin >> str;
  int firstLength = str.length();
  string replacement = "";
  while (true) {
    if ((str.find("01")) == string::npos && (str.find("10")) == string::npos) {
      break;
    }
    if ((str.find("01")) == string::npos) {
      str = ReplaceString(str, "01", "");
    } else {
      str = ReplaceString(str, "10", "");
    }
  }
  cout << firstLength - str.length();
  return 0;
}
