#include<bits/stdc++.h>
using namespace std;
#define el "\n"
#define ll long long
#define ull unsigned long long
#define se second
#define fi first
#define be begin()
#define en end()
#define Faster cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
int main()
{
Faster;
string s; cin >> s;
vector<char> vt;
if(s.size() <= 1)
{
cout << 0;
return 0;
}
vt.push_back(s[0]);
for(int i = 1; i < s.size(); i++)
{
if(vt.back() != s[i]) vt.push_back(s[i]);
}
cout << s.size() - vt.size();
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKI2RlZmluZSBlbCAiXG4iCiNkZWZpbmUgbGwgbG9uZyBsb25nCiNkZWZpbmUgdWxsIHVuc2lnbmVkIGxvbmcgbG9uZwojZGVmaW5lIHNlIHNlY29uZAojZGVmaW5lIGZpIGZpcnN0CiNkZWZpbmUgYmUgYmVnaW4oKQojZGVmaW5lIGVuIGVuZCgpCiNkZWZpbmUgRmFzdGVyIGNpbi50aWUoMCk7IGNvdXQudGllKDApOyBpb3NfYmFzZTo6c3luY193aXRoX3N0ZGlvKDApOwoKaW50IG1haW4oKQp7CiAgICBGYXN0ZXI7CiAgICBzdHJpbmcgczsgY2luID4+IHM7CiAgICB2ZWN0b3I8Y2hhcj4gdnQ7CiAgICBpZihzLnNpemUoKSA8PSAxKQogICAgewogICAgICAgIGNvdXQgPDwgMDsKICAgICAgICByZXR1cm4gMDsKICAgIH0KICAgIHZ0LnB1c2hfYmFjayhzWzBdKTsKICAgIGZvcihpbnQgaSA9IDE7IGkgPCBzLnNpemUoKTsgaSsrKQogICAgewogICAgICAgIGlmKHZ0LmJhY2soKSAhPSBzW2ldKSB2dC5wdXNoX2JhY2soc1tpXSk7CiAgICB9CiAgICBjb3V0IDw8IHMuc2l6ZSgpIC0gdnQuc2l6ZSgpOwogICAgcmV0dXJuIDA7Cn0K