#include <bits/stdc++.h>
template <typename T>
T gcd(T a, T b) {
  return b == 0 ? a : gcd(b, a % b);
}
template <typename T>
T lcm(T a, T b) {
  return a * b / gcd(a, b);
}
template <typename T>
T clamp(T val, T min, T max) {
  return val < min ? min : (max < val ? max : val);
}
template <typename T>
size_t max_index(T begin, T end) {
  return distance(begin, max_element(begin, end));
}
template <typename T>
size_t min_index(T begin, T end) {
  return distance(begin, min_element(begin, end));
}
using namespace std;
signed main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int num = 0;
  string s;
  cin >> s;
  while (true) {
    auto found = s.find("0011");
    if (found != string::npos) {
      s.erase(found, 4);
      num += 2;
    }
    found = s.find("1100");
    if (found != string::npos) {
      s.erase(found, 4);
      num += 2;
    }
    auto found1 = s.rfind("01");
    auto found2 = s.rfind("10");
    if (found1 == string::npos && found2 == string::npos) {
      break;
    } else {
      s.erase(min(found1, found2), 2);
    }
    ++num;
  }
  cout << 2 * num << endl;
  return 0;
}
