stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include <iostream>

using namespace std;



int main(){

	string s;

	

	cin >> s;

	int i = 0,ans = 0;

	char c = s[0];

	

	while(i<s.size()){

		while(s[i]==c&&i<s.size()) i++;

		ans++;

		c = s[i];

	}

	 cout << ans-1;

}

// Faster C++ solution for the same problem (measured speedup: 5.265637597991571x):
#include <cstdio>

#include <cstring>

#define N 100010

char str[N];

int n,ans;

int main(){

	scanf("%s",str+1);

	n=strlen(str+1);

	for(int i=2;i<=n;++i) if(str[i]!=str[i-1]) ans++;

	printf("%d\n",ans);

	return 0; 

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

int  main(){

    string s;

    cin>>s;

    if(s.find('W')==-1||s.find('B')==-1){

        cout<<"0"<<endl;

    }

else{

    int cnt=0;

        for(int i=0; i<s.size()-1; i++){

            if(s[i]!=s[i+1])

                cnt++;

        }

        cout<<cnt<<endl;

}

return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.322409464591368x):
#include <cstdio>

#include <cstring>

#define N 100010

char str[N];

int n,ans;

int main(){

	scanf("%s",str+1);

	n=strlen(str+1);

	for(int i=2;i<=n;++i) if(str[i]!=str[i-1]) ans++;

	printf("%d\n",ans);

	return 0; 

}
// Slower C++ solution:
#include<iostream>

#include<cstring>

using namespace std;

int main() {

	int ans = 0;

	string s; 

	cin>>s;

	for(int i=0;i<s.length()-1;i++) {

		if(s[i]!=s[i+1])

			ans++;

	}

	cout<<ans<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.319641512476496x):
#include <cstdio>

#include <cstring>

#define N 100010

char str[N];

int n,ans;

int main(){

	scanf("%s",str+1);

	n=strlen(str+1);

	for(int i=2;i<=n;++i) if(str[i]!=str[i-1]) ans++;

	printf("%d\n",ans);

	return 0; 

}
// Slower C++ solution:
#include<iostream>

#include<algorithm>

#include<cmath>

#include<cstring>

#include<cstdlib>

#include<ctime>

#include<cstdio>

#include<string>

//#include<string>

//#include<sstream>

using namespace std;



int main()

{

	int n,i,l;

	char a[100005];

	scanf("%s",&a);

	l=strlen(a);

	n=1;

	for(i=0;i<l-1;i++)

	{

		if(a[i]!=a[i+1])

			n++;

	}

	printf("%d\n",n-1);

}

// Faster C++ solution for the same problem (measured speedup: 5.218848703530285x):
#include <cstdio>

#include <cstring>

#define N 100010

char str[N];

int n,ans;

int main(){

	scanf("%s",str+1);

	n=strlen(str+1);

	for(int i=2;i<=n;++i) if(str[i]!=str[i-1]) ans++;

	printf("%d\n",ans);

	return 0; 

}
// Slower C++ solution:
#include <stdio.h>

#include <math.h>

#include <string.h>

#include <algorithm>

#include <iostream>

#include <string>

#include <time.h>

#include <queue>

#include <list>

#include <string.h>

#define sf scanf

#define pf printf

#define lf double

#define ll long long

#define p123 printf("123\n");

#define pn printf("\n");

#define pk printf(" ");

#define p(n) printf("%d",n);

#define pln(n) printf("%d\n",n);

#define s(n) scanf("%d",&n);

#define ss(n) scanf("%s",n);

#define ps(n) printf("%s",n);

#define sld(n) scanf("%lld",&n);

#define pld(n) printf("%lld",n);

#define slf(n) scanf("%lf",&n);

#define plf(n) printf("%lf",n);

#define sc(n) scanf("%c",&n);

#define pc(n) printf("%c",n);

#define gc getchar();

#define re(n,a) memset(n,a,sizeof(n));

#define len(a) strlen(a)

#define LL long long

#define eps 1e-6

using namespace std;

const double pi = 3.1415926535;

/*

https://codeforces.com/contest/1106/problems

https://codeforces.com/contest/1106/submit

*/



int main(){

	/*ll n,x;

	ll a[1000000];

    sld(n) sld(x)

    ll sum = 0;

    for(ll i = 0; i < n; i ++){



    }*/



    char a[1000000];

    ss(a)

    int lena = len(a);

    int sum = 0;

    for(int i = 1; i <lena; i ++){

        if(a[i] != a[i-1]){

            sum ++;

        }

    }

    p(sum) pn

    return 0;



}




// Faster C++ solution for the same problem (measured speedup: 5.340682978499921x):
#include <cstdio>

#include <cstring>

#define N 100010

char str[N];

int n,ans;

int main(){

	scanf("%s",str+1);

	n=strlen(str+1);

	for(int i=2;i<=n;++i) if(str[i]!=str[i-1]) ans++;

	printf("%d\n",ans);

	return 0; 

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

#define ll long long



char s[100005];

int main()

{

    int b,w;

	while(cin >> s)

	{

	    b = 0,w = 0;

	    int len = strlen(s);

	    bool bf = 0,wf = 0;

	    for(int i = 0;i < len;i++)

	    {

	        if(s[i] == 'B' && bf == 0)

	        {

	            b++;

	            bf = 1,wf = 0;

	        }

	        if(s[i] == 'W' && wf == 0)

	        {

	            w++;

	            wf = 1,bf = 0;

	        }

	    }

	    cout << b + w - 1<< endl;

	}

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.2828844102605075x):
#include <cstdio>

#include <cstring>

#define N 100010

char str[N];

int n,ans;

int main(){

	scanf("%s",str+1);

	n=strlen(str+1);

	for(int i=2;i<=n;++i) if(str[i]!=str[i-1]) ans++;

	printf("%d\n",ans);

	return 0; 

}
// Slower C++ solution:
#include <iostream>

#include <cstdio> 

#include <cstring>

#include <cmath>

#include <string>

using namespace std;



int main()

{

	string s;

	cin>>s;

	int ans=0;

	for(int i=s.size()-1;i>0;i--)

	{

		if(s[i]==s[i-1]) continue;

		else

		{

			ans++; 

		}

	}	cout<<ans<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.318693218887168x):
#include <cstdio>

#include <cstring>

#define N 100010

char str[N];

int n,ans;

int main(){

	scanf("%s",str+1);

	n=strlen(str+1);

	for(int i=2;i<=n;++i) if(str[i]!=str[i-1]) ans++;

	printf("%d\n",ans);

	return 0; 

}
// Slower C++ solution:
#include <iostream>

using namespace std;



int main(){

	string s;

	

	cin >> s;

	int i = 0,ans = 0;

	char c = s[0];

	

	while(i<s.size()){

		while(s[i]==c&&i<s.size()) i++;

		ans++;

		c = s[i];

	}

	 cout << ans-1;

}

// Faster C++ solution for the same problem (measured speedup: 5.28032358609108x):
#include<cstdio>

#include<cmath>

#include<algorithm>

#include<cstring>



using namespace std;



char orin[100005];



int main(void)

{

	int cnt = 0;

	scanf("%s", orin);

	for (int i = 1; orin[i]; ++i)

	{

		if (orin[i] != orin[i - 1])

			++cnt;

	}

	printf("%d", cnt);

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

int  main(){

    string s;

    cin>>s;

    if(s.find('W')==-1||s.find('B')==-1){

        cout<<"0"<<endl;

    }

else{

    int cnt=0;

        for(int i=0; i<s.size()-1; i++){

            if(s[i]!=s[i+1])

                cnt++;

        }

        cout<<cnt<<endl;

}

return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.337253790772782x):
#include<cstdio>

#include<cmath>

#include<algorithm>

#include<cstring>



using namespace std;



char orin[100005];



int main(void)

{

	int cnt = 0;

	scanf("%s", orin);

	for (int i = 1; orin[i]; ++i)

	{

		if (orin[i] != orin[i - 1])

			++cnt;

	}

	printf("%d", cnt);

}
// Slower C++ solution:
#include<iostream>

#include<cstring>

using namespace std;

int main() {

	int ans = 0;

	string s; 

	cin>>s;

	for(int i=0;i<s.length()-1;i++) {

		if(s[i]!=s[i+1])

			ans++;

	}

	cout<<ans<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.334478118773839x):
#include<cstdio>

#include<cmath>

#include<algorithm>

#include<cstring>



using namespace std;



char orin[100005];



int main(void)

{

	int cnt = 0;

	scanf("%s", orin);

	for (int i = 1; orin[i]; ++i)

	{

		if (orin[i] != orin[i - 1])

			++cnt;

	}

	printf("%d", cnt);

}
// Slower C++ solution:
#include<iostream>

#include<algorithm>

#include<cmath>

#include<cstring>

#include<cstdlib>

#include<ctime>

#include<cstdio>

#include<string>

//#include<string>

//#include<sstream>

using namespace std;



int main()

{

	int n,i,l;

	char a[100005];

	scanf("%s",&a);

	l=strlen(a);

	n=1;

	for(i=0;i<l-1;i++)

	{

		if(a[i]!=a[i+1])

			n++;

	}

	printf("%d\n",n-1);

}

// Faster C++ solution for the same problem (measured speedup: 5.233404196293862x):
#include<cstdio>

#include<cmath>

#include<algorithm>

#include<cstring>



using namespace std;



char orin[100005];



int main(void)

{

	int cnt = 0;

	scanf("%s", orin);

	for (int i = 1; orin[i]; ++i)

	{

		if (orin[i] != orin[i - 1])

			++cnt;

	}

	printf("%d", cnt);

}
// Slower C++ solution:
#include <stdio.h>

#include <math.h>

#include <string.h>

#include <algorithm>

#include <iostream>

#include <string>

#include <time.h>

#include <queue>

#include <list>

#include <string.h>

#define sf scanf

#define pf printf

#define lf double

#define ll long long

#define p123 printf("123\n");

#define pn printf("\n");

#define pk printf(" ");

#define p(n) printf("%d",n);

#define pln(n) printf("%d\n",n);

#define s(n) scanf("%d",&n);

#define ss(n) scanf("%s",n);

#define ps(n) printf("%s",n);

#define sld(n) scanf("%lld",&n);

#define pld(n) printf("%lld",n);

#define slf(n) scanf("%lf",&n);

#define plf(n) printf("%lf",n);

#define sc(n) scanf("%c",&n);

#define pc(n) printf("%c",n);

#define gc getchar();

#define re(n,a) memset(n,a,sizeof(n));

#define len(a) strlen(a)

#define LL long long

#define eps 1e-6

using namespace std;

const double pi = 3.1415926535;

/*

https://codeforces.com/contest/1106/problems

https://codeforces.com/contest/1106/submit

*/



int main(){

	/*ll n,x;

	ll a[1000000];

    sld(n) sld(x)

    ll sum = 0;

    for(ll i = 0; i < n; i ++){



    }*/



    char a[1000000];

    ss(a)

    int lena = len(a);

    int sum = 0;

    for(int i = 1; i <lena; i ++){

        if(a[i] != a[i-1]){

            sum ++;

        }

    }

    p(sum) pn

    return 0;



}




// Faster C++ solution for the same problem (measured speedup: 5.355578269944857x):
#include<cstdio>

#include<cmath>

#include<algorithm>

#include<cstring>



using namespace std;



char orin[100005];



int main(void)

{

	int cnt = 0;

	scanf("%s", orin);

	for (int i = 1; orin[i]; ++i)

	{

		if (orin[i] != orin[i - 1])

			++cnt;

	}

	printf("%d", cnt);

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

#define ll long long



char s[100005];

int main()

{

    int b,w;

	while(cin >> s)

	{

	    b = 0,w = 0;

	    int len = strlen(s);

	    bool bf = 0,wf = 0;

	    for(int i = 0;i < len;i++)

	    {

	        if(s[i] == 'B' && bf == 0)

	        {

	            b++;

	            bf = 1,wf = 0;

	        }

	        if(s[i] == 'W' && wf == 0)

	        {

	            w++;

	            wf = 1,bf = 0;

	        }

	    }

	    cout << b + w - 1<< endl;

	}

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.2976185001283245x):
#include<cstdio>

#include<cmath>

#include<algorithm>

#include<cstring>



using namespace std;



char orin[100005];



int main(void)

{

	int cnt = 0;

	scanf("%s", orin);

	for (int i = 1; orin[i]; ++i)

	{

		if (orin[i] != orin[i - 1])

			++cnt;

	}

	printf("%d", cnt);

}
// Slower C++ solution:
#include <iostream>

#include <cstdio> 

#include <cstring>

#include <cmath>

#include <string>

using namespace std;



int main()

{

	string s;

	cin>>s;

	int ans=0;

	for(int i=s.size()-1;i>0;i--)

	{

		if(s[i]==s[i-1]) continue;

		else

		{

			ans++; 

		}

	}	cout<<ans<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.333527180371207x):
#include<cstdio>

#include<cmath>

#include<algorithm>

#include<cstring>



using namespace std;



char orin[100005];



int main(void)

{

	int cnt = 0;

	scanf("%s", orin);

	for (int i = 1; orin[i]; ++i)

	{

		if (orin[i] != orin[i - 1])

			++cnt;

	}

	printf("%d", cnt);

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

void solution()

{

    string st;

    int n;

    int res=0;

    cin>>st;

    n=st.size();

    for(int i=1;i<n;i++)

    {

        if(st[i-1]!=st[i])

        {

            res++;

        }

    }

    cout<<res<<endl;

}

int main()

{

    solution();

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.330201121246872x):
#include<cstdio>

#include<cmath>

#include<algorithm>

#include<cstring>



using namespace std;



char orin[100005];



int main(void)

{

	int cnt = 0;

	scanf("%s", orin);

	for (int i = 1; orin[i]; ++i)

	{

		if (orin[i] != orin[i - 1])

			++cnt;

	}

	printf("%d", cnt);

}
// Slower C++ solution:
//

/*==========================================================*/

/*    Template ver 2017-0720    |    Created by JollyBee    */

/* DOMINUS pascit me, et nihil mihi deerit (Psalmorum 23:1) */

/*==========================================================*/

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

typedef unsigned long long ull;

typedef vector<int> vi;

typedef pair<int,int> pii;

typedef pair<ll,ll> pll;

typedef vector<pii> vii;

const double EPS=(double)1e-9;

const double PI=(double)acos(-1.0);

#define fi first

#define se second

#define mp make_pair

#define pb push_back

#define pob pop_back

#define pf push_front

#define pof pop_front

#define FOR(i,n) for(int i=0;i<n;i++)

#define REPP(i,l,r,c) for(int i=l;i<=r;i+=c)

#define REP(i,l,r) REPP(i,l,r,1)

#define FORD(i,n) for(int i=n-1;i>=0;i--)

#define REVV(i,l,r,c) for(int i=l;i>=r;i-=c)

#define REV(i,l,r) REVV(i,l,r,1)

//random

int irand(int lo, int hi){

    return (((double)rand())/(RAND_MAX+1.0)) * (hi-lo+1) + lo;

}

//ll to string

string toString(ll x) {

    stringstream ss;

    ss << x;

    return ss.str();

}

//string to ll

ll toNumber(string S) {

    ll ret;

    sscanf(S.c_str(),"%lld",&ret);

    return ret;

}

// std::fill(start, end, value);

// for(auto it: DS){}



const int INF=(int)2e9;

const ll MOD=(ll)1e9+7;

/*==========================================================*/

/*                     END OF TEMPLATE                      */

/* DOMINUS pascit me, et nihil mihi deerit (Psalmorum 23:1) */

/*==========================================================*/



const int N = (int)1e5;



char s[N+5];



int main(){

    scanf("%s", s);

    int res = 0;

    for(int i=1; s[i]; i++) res += (s[i-1] != s[i]);

    printf("%d\n", res);

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.354002768254382x):
#include<cstdio>

#include<cmath>

#include<algorithm>

#include<cstring>



using namespace std;



char orin[100005];



int main(void)

{

	int cnt = 0;

	scanf("%s", orin);

	for (int i = 1; orin[i]; ++i)

	{

		if (orin[i] != orin[i - 1])

			++cnt;

	}

	printf("%d", cnt);

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;



string s;



int main(){

	cin >> s;

	int ans = 0;

	for(int i=1;i<s.size();i++){

		if(s[i] != s[i-1]) ans++;

	}

	cout << ans << endl;

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.2935506793794715x):
#include<cstdio>

#include<cmath>

#include<algorithm>

#include<cstring>



using namespace std;



char orin[100005];



int main(void)

{

	int cnt = 0;

	scanf("%s", orin);

	for (int i = 1; orin[i]; ++i)

	{

		if (orin[i] != orin[i - 1])

			++cnt;

	}

	printf("%d", cnt);

}
// Slower C++ solution:
#include <iostream>

#include <cmath>

#include <stdio.h>

#include <algorithm>

#include <string>

#include <vector>

#include <queue>

#include <deque>

#include <stack>

#include <map>

#include <set>

#include <cstring>



using namespace std;



#define f first

#define s second

#define pb push_back

#define mp make_pair

#define ll long long

#define pii pair < int, int >

#define pll pair < long long, long long>

#define ull unsigned long long

#define vi vector < int >

#define vll vector < long long >

#define sz(a) (int)a.size()

#define forit(it, s) for(__typeof(s.begin()) it = s.begin(); it != s.end(); it++)

#define all(a) a.begin(), a.end()

#define sqr(x) ((x) * (x))

#define fname "searching"



const int inf = (int)1e9;

const ll INF = (ll)1e18;

const double eps = 1e-9;

const double pi = acos(-1.0);

const int mod = (int)1e9 + 7;



int solve(){

    string s, t = "";

    cin >> s;

    t += s[0];

    for(int i = 1; i < s.size(); ++i){

        if(s[i] != t[t.size() - 1]) t += s[i];

    }

    // cout << t << "\n";

    return t.size() - 1;

}



int main(){

    ios_base::sync_with_stdio(0);

    cin.tie(0);



    cout << solve() << "\n";

    

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.378802826408494x):
#include<cstdio>

#include<cmath>

#include<algorithm>

#include<cstring>



using namespace std;



char orin[100005];



int main(void)

{

	int cnt = 0;

	scanf("%s", orin);

	for (int i = 1; orin[i]; ++i)

	{

		if (orin[i] != orin[i - 1])

			++cnt;

	}

	printf("%d", cnt);

}
// Slower C++ solution:
#include<iostream>

#include<cstring>

#include<cmath>

#include<cstdio>

#include<algorithm>



using namespace std;

const int maxn = 200000+5;

int n,f[maxn],g[maxn];

char S[maxn];



int main(){

	int i,j;

	scanf("%s",S+1);

	n = strlen(S+1);

	for(i=2;i<=n;i++)

		f[i] = S[i] == S[i-1] ? f[i-1]:f[i-1]+1;

	for(i=n-1;i>0;i--)

		g[i] = S[i] == S[i+1] ? g[i+1]:g[i+1]+1;

	int ans = 0x3f3f3f3f;

	for(i=1;i<=n;i++)

		ans = min(f[i]+g[i],ans);

	cout<<ans<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.2821953839007545x):
#include <cstdio>

#include <cstring>

char s[100010]; int n, ans;

int main() {

	scanf("%s", s); n = strlen(s);

	for (int i = 1; i < n; ++ i) {

		if (s[i] != s[i - 1]) ++ ans;

	}

	printf("%d\n", ans);

	return 0;

}
// Slower C++ solution:
#include<iostream>

#include<cstring>

#include<cmath>

#include<cstdio>

#include<algorithm>



using namespace std;

const int maxn = 200000+5;

int n,f[maxn],g[maxn];

char S[maxn];



int main(){

	int i,j;

	scanf("%s",S+1);

	n = strlen(S+1);

	for(i=2;i<=n;i++)

		f[i] = S[i] == S[i-1] ? f[i-1]:f[i-1]+1;

	for(i=n-1;i>0;i--)

		g[i] = S[i] == S[i+1] ? g[i+1]:g[i+1]+1;

	int ans = 0x3f3f3f3f;

	for(i=1;i<=n;i++)

		ans = min(f[i]+g[i],ans);

	cout<<ans<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.280250387811265x):
#include <cstdio>

#include <cstring>

char s[110000];

int main(){

	scanf("%s",s);

	int l=strlen(s),ans=0;

	for(int i=0;i<l-1;++i)

		if(s[i]!=s[i+1]) ++ans;

	printf("%d\n",ans);

	return 0;

}
// Slower C++ solution:
#include<iostream>

#include<algorithm>

#include<cmath>

#include<string>



using namespace std;

typedef long long ll;



int main()

{

    string s;

    int sum = 0;

    cin >> s;

    for(int i = 0; i < s.length()-1; i++){

        if(s[i] != s[i+1]) sum++;

    }

    cout << sum;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.266621908785607x):
#include <cstdio>

#include <cstring>

char s[110000];

int main(){

	scanf("%s",s);

	int l=strlen(s),ans=0;

	for(int i=0;i<l-1;++i)

		if(s[i]!=s[i+1]) ++ans;

	printf("%d\n",ans);

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>



using namespace std;



char ch[1000005];



int main()

{

    long int s=0,l=0,i,j;



    scanf("%[^\n]",ch);

    l=strlen(ch);



    for(i=1; i<l; i++){

        if (ch[i]!=ch[i-1]){

            ++s;

        }

    }

    printf("%ld\n",s);

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.213393056514712x):
#include <cstdio>

#include <cstring>

char s[110000];

int main(){

	scanf("%s",s);

	int l=strlen(s),ans=0;

	for(int i=0;i<l-1;++i)

		if(s[i]!=s[i+1]) ++ans;

	printf("%d\n",ans);

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;



int main(){

    int a_i, b_i, n, temp, cont = 0;

    string st;



    cin>>st;



    char chCu = st[0], cht;

    temp = st.size();

    for( a_i=0; a_i<temp; a_i++ ){

        if( st[a_i] != chCu ){

            cont++;

            chCu = st[a_i];

        }

    }



    cout<<cont<<endl;



}


// Faster C++ solution for the same problem (measured speedup: 5.3164909624078165x):
#include <cstdio>

#include <cstring>

char s[110000];

int main(){

	scanf("%s",s);

	int l=strlen(s),ans=0;

	for(int i=0;i<l-1;++i)

		if(s[i]!=s[i+1]) ++ans;

	printf("%d\n",ans);

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>



using namespace std;



char c[100010];

int cnt1,cnt2,len;



int main()

{

	scanf("%s",c+1);

	len=strlen(c+1);

	for(int i=2; i<=len; i++)if(c[i]!=c[i-1])cnt1++;

	for(int i=len-1; i>=1; i--)if(c[i]!=c[i+1])cnt2++;

	printf("%d",min(cnt1,cnt2));

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.214220356395835x):
#include <cstdio>

#include <cstring>

#include <algorithm>

#include <cmath>

#include <cstdlib>



#define cmax(_a, _b) (_a < (_b) ? _a = (_b), 1 : 0)

#define cmin(_a, _b) (_a > (_b) ? _a = (_b), 1 : 0)

#define dmax(_a, _b) ((_a) > (_b) ? (_a) : (_b))

#define dmin(_a, _b) ((_a) < (_b) ? (_a) : (_b))



#define maxn 100010

typedef long long ll;

typedef double db;



int a[maxn];

char s[maxn];

int main()

{

	scanf("%s", s + 1);

	int n = strlen(s + 1);

	int ans = 1;

	for (int i = 2; i <= n; ++i)

		if (s[i] != s[i - 1]) ++ans;

	printf("%d\n", ans - 1);

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>



using namespace std;



char c[100010];

int cnt1,cnt2,len;



int main()

{

	scanf("%s",c+1);

	len=strlen(c+1);

	for(int i=2; i<=len; i++)if(c[i]!=c[i-1])cnt1++;

	for(int i=len-1; i>=1; i--)if(c[i]!=c[i+1])cnt2++;

	printf("%d",min(cnt1,cnt2));

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.218555685252828x):
#include<cmath>

#include<cstdio>

#include<cstring>

#include<algorithm>

#define cmax(_i,_j) ((_i)<(_j)?(_i)=(_j):0)

#define cmin(_i,_j) ((_i)>(_j)?(_i)=(_j):0)

#define N 100005

using namespace std;

namespace runzhe2000

{

	char s[N]; int n, ans;

	void main()

	{

		scanf("%s",s+1); n = strlen(s+1);

		for(int i = 2; i <= n; i++) if(s[i] != s[i-1]) ans++;

		printf("%d\n",ans);

	}

}

int main()

{

	runzhe2000::main();

}
// Slower C++ solution:
#include<bits/stdc++.h>



using namespace std;



char c[100010];

int cnt1,cnt2,len;



int main()

{

	scanf("%s",c+1);

	len=strlen(c+1);

	for(int i=2; i<=len; i++)if(c[i]!=c[i-1])cnt1++;

	for(int i=len-1; i>=1; i--)if(c[i]!=c[i+1])cnt2++;

	printf("%d",min(cnt1,cnt2));

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.226535447421178x):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

char s[100005];

int main(){

	scanf("%s",s);

	int n=strlen(s);

	int ans=0;

	for(int i=1;i<n;i++)ans+=s[i]!=s[i-1];

	printf("%d",ans);

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>



using namespace std;



char c[100010];

int cnt1,cnt2,len;



int main()

{

	scanf("%s",c+1);

	len=strlen(c+1);

	for(int i=2; i<=len; i++)if(c[i]!=c[i-1])cnt1++;

	for(int i=len-1; i>=1; i--)if(c[i]!=c[i+1])cnt2++;

	printf("%d",min(cnt1,cnt2));

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.2232926612568855x):
#include<stdio.h>

#include<stdlib.h>

#include<string.h>

typedef long long ll;

char str[100005];

int main(void)

{

	scanf("%s", str);

	int len = strlen(str);

	int ans = 0;

	char t = str[0];

	for (int i = 1; i < len; i++)

		if (str[i] != t) {

			t = str[i];

			ans++;

		}

	printf("%d\n", ans);

	return 0;

}