#include <bits/stdc++.h>
using namespace std;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int INF = 999999999;
void readFromInputFile() {}
int main() {
  readFromInputFile();
  string s;
  cin >> s;
  int map[2][100002] = {};
  memset(map, -1, sizeof(map));
  for (int i = 0; i < (int)(s.size()); i++) {
    map[0][i] = s[i] == '1';
  }
  int i = 0;
  int sum = 0;
  while (true) {
    bool flg = false;
    int maxi = 0;
    for (int j = 0; j < (int)(100002); j++) {
      if (map[i][j] == -1) break;
      if (map[i][j] != map[i][j + 1] && map[i][j + 1] != -1) {
        j++;
        flg = true;
        sum++;
        continue;
      }
      map[(i + 1) % 2][maxi++] = map[i][j];
    }
    if (!flg) {
      break;
    }
    memset(map[i], -1, sizeof(map[i]));
    i = (i + 1) % 2;
  }
  cout << sum * 2 << endl;
  return 0;
}
