#include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 60;
string S;
long long blocks = INF, quesize, sum = 0;
int main() {
  cin >> S;
  queue<char> que;
  for (long long i = 0; i < (S.length()); ++i) que.push(S[i]);
  while (blocks != 0) {
    blocks = 0;
    quesize = que.size();
    for (long long i = 0; i < (quesize); ++i) {
      char c1 = que.front();
      que.pop();
      char c2 = que.front();
      if (((c1 - 48) + (c2 - 48)) == 1) {
        blocks++;
        i++;
        que.pop();
      } else
        que.push(c1);
    }
    sum += blocks;
  }
  cout << sum * 2 << endl;
  return 0;
}
