#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int n = s.size();
  queue<bool> q;
  int cnt{};
  for (auto i : s) q.push(i - '0');
  auto p = q;
  while (1) {
    q = p;
    p = {};
    auto qold = q;
    if (q.size() < 2) break;
    while (!q.empty()) {
      if (q.size() == 1) {
        p.push(q.front());
        break;
      }
      bool a = q.front();
      q.pop();
      bool b = q.front();
      if (!(a ^ b)) {
        p.push(a);
      } else {
        q.pop();
        cnt += 2;
      }
    }
    if (qold == p) break;
  }
  cout << cnt << endl;
}
