#include <bits/stdc++.h>
using namespace std;
string s;
int main() {
  ios::sync_with_stdio(false);
  ;
  string s;
  getline(cin, s);
  int ans = 0;
  s = ' ' + s;
  for (int i = 1; i < s.size(); i++) {
    if (s[i] == s[i - 1] || s[i] == s[i + 1]) {
      ans++;
    } else {
      for (int j = i - 1; j >= 1; j--) {
        if (s[j] == s[i] && s[j] != s[j - 1] && s[j] != s[j + 1]) {
          ans++;
          break;
        }
      }
    }
  }
  cout << ans;
}
