#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int n;
string br;
int main(){
    n=br.size();
cin>>br;
int x=0;
for(int i=0;i<br.size();i++){
    for(int k=i+1;k<=br.size()-1;k++){
    if(br[k]==br[i] and br[i]!=br[i-1] ){x+=k-i-1;
    i=k;
    }
}
}
cout<<x<<endl;
    return 0;
}