#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int n = s.size();
  vector<int> pre(n), post(n), dond(n);
  for (int i = 0; i < n; ++i) pre[i] = i - 1, post[i] = i + 1;
  int res = 0;
  for (int i = 1; i < n; i++) {
    if (pre[i] == -1) {
      continue;
    }
    if (s[i] != s[pre[i]]) {
      res += 2;
      pre[i + 1] = pre[pre[i]];
    }
  }
  printf("%d\n", res);
}
