#include <bits/stdc++.h>
using namespace std;
std::string Replace(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 n;
  cin >> n;
  size_t motononagasa, atononagasa;
  motononagasa = n.length();
  while (n.find("01") != std::string::npos) {
    n = Replace(n, "01", "");
    n = Replace(n, "10", "");
  }
  while (n.find("10") != std::string::npos) {
    n = Replace(n, "10", "");
    n = Replace(n, "01", "");
  }
  atononagasa = n.length();
  std::cout << motononagasa - atononagasa << std::endl;
}
