#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  int start = 0;
  int count = 0;
  for (int i = 0; i < S.size() - 1; i++) {
    if (S[start] != S[start + 1]) {
      count++;
      start += 2;
    } else {
      start++;
    }
    if (start > S.size()) {
      break;
    }
  }
  cout << count * 2 << endl;
  return 0;
}
