#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  cin >> str;
  int cnt = 0;
  string nov;
  for (int i = 0; i < str.size(); i++) {
    if (str[i] != str[i + 1]) {
      cnt++;
      i++;
      continue;
    } else
      nov.push_back(str[i]);
  }
  if (str.size() == 1)
    cout << 0 << endl;
  else
    cout << cnt * 2 << endl;
}
