#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  s = '2' + s;
  char prec = s[0];
  int ans = 0;
  for (int i = 1; i < s.size(); i++) {
    if (s[i] == prec) {
      ans += 2;
      prec = s[i - 2];
    } else {
      prec = s[i];
    }
  }
  cout << ans << endl;
  return 0;
}
