#include <bits/stdc++.h>
using namespace std;
// 双指针
string s;
int main(){
cin >> s;
int res = 0;
int j = 0;
int i = 0;
for(;i<s.size();i++){
if(s[i] != s[j]){
res += (i-j-2);
j = i;
}
}
res += (i-j-2);
cout<<res<<endl;
return 0;
}