#include <bits/stdc++.h>
using namespace std;
int n;
string s;
bool check;
bool vis[3003000];
int cnt = 0;
string b;
int main() {
  cin >> s;
  memset(vis, 0, sizeof(vis));
  n = s.size();
  while (true) {
    for (int i = 1; i < n; i++) vis[i] = false;
    check = true;
    for (int i = 1; i < n; i++) {
      if (vis[i] || vis[i - 1]) continue;
      if (s[i] - '0' + s[i - 1] - '0' == 1) {
        cnt += 2;
        vis[i] = 1;
        vis[i - 1] = 1;
        check = false;
      }
    }
    int c = 0;
    for (int i = 0; i < n; i++) {
      if (vis[i]) continue;
      b[c] = s[i];
      c++;
    }
    n = c;
    s = "0";
    for (int i = 0; i < n; i++) {
      s[i] = b[i];
    }
    b = "0";
    if (check == true) {
      break;
    }
  }
  cout << cnt << endl;
}
