#include <bits/stdc++.h>
const long long LINF = 1e18;
const int INF = 1e8;
using namespace std;
int main(void) {
  string s;
  string tmp;
  long long tobasu[100010] = {};
  long long count = 0;
  cin >> s;
  long long n = s.size();
  s[n] = '\0';
  while (true) {
    tmp = s;
    for (int i = 0; i < n; i++) {
      if ((s[i] == '0' && s[i + tobasu[i] + 1] == '1') ||
          (s[i] == '1' && s[i + tobasu[i] + 1] == '0')) {
        count += 2;
        s[i] = s[i + tobasu[i] + 1] = 2;
        int sa = 1;
        while (s[i - sa] == 2) {
          sa++;
        }
        if (i > 0) tobasu[i - sa] += tobasu[i] + 2;
      }
    }
    if (tmp == s) break;
  }
  cout << count << endl;
}
