stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



using VS = vector<string>;    using LL = long long;

using VI = vector<int>;       using VVI = vector<VI>;

using PII = pair<int, int>;   using PLL = pair<LL, LL>;

using VL = vector<LL>;        using VVL = vector<VL>;



#define ALL(a)  begin((a)),end((a))

#define RALL(a) (a).rbegin(), (a).rend()

#define PB push_back

#define EB emplace_back

#define MP make_pair

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

#define SORT(c) sort(ALL((c)))

#define RSORT(c) sort(RALL((c)))

#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)

#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)

#define debug(x) cerr << #x << ": " << x << endl

const int INF = 1e9;                          const LL LINF = 1e16;

const LL MOD = 1000000007;                    const double PI = acos(-1.0);

int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };



/* -----  2018/02/14  Problem: 063_arc_a / Link: https://abc047.contest.atcoder.jp/tasks/arc063_a?lang=en  ----- */

/* ------問題------



きつねの次郎と三郎が一次元リバーシで遊んでいます。一次元リバーシでは、盤面には白か黒の石が一列に並んだ状態となっており、列の右端か左端に新たに石を打っていきます。通常のリバーシと同じように、たとえば白の石を打つことで黒の石を挟むと、挟まれた黒の石は白い石に変わります。

ゲームの途中で三郎に急用ができて帰ってしまうことになりました。このとき、盤面の状態は文字列 S で表されます。石は |S| (文字列の長さ) 個並んでおり、左から i (1≦i≦|S|) 個目の石の色は、S の i 文字目が B のとき黒、W のとき白です。

次郎は現在の盤面に対して、できるだけ少ない個数の石を新たに打つことで全ての石を同じ色にしようと考えました。最小で何個の石を打てばよいかを求めてください。



-----問題ここまで----- */

/* -----解説等-----







----解説ここまで---- */



LL N;



LL ans = 0LL;



int main() {

	cin.tie(0);

	ios_base::sync_with_stdio(false);



	string s;

	cin >> s;

	char t = s[0];

	FOR(i, 1, SZ(s)) {

		if (t != s[i]) {

			t = s[i];

			ans++;

		}

	}

	cout << ans << "\n";



	return 0;

}


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

#include<string.h>

#include<algorithm>

using namespace std;

const int mod=1e9+7;

char a[100001];

int main()

{

	int n;

	scanf("%d",&n);

	scanf("%s",a);

	int len=strlen(a);

	int ans=0; 

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

	{

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

		ans++;

	}

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

	return 0;

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

#include <stdlib.h>

#include <string.h>

#include <algorithm>

#include <cstdio> 

#define N 100000+5

using namespace std; 

int main(){

	char s[N];

	cin >> s;

	int ans=0;

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

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

			ans++;

		}

		else{

			continue;

		}

	} 

	cout << ans << endl;

	return 0;

}

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

#include<string.h>

#include<algorithm>

using namespace std;

const int mod=1e9+7;

char a[100001];

int main()

{

	int n;

	scanf("%d",&n);

	scanf("%s",a);

	int len=strlen(a);

	int ans=0; 

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

	{

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

		ans++;

	}

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

	return 0;

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

#include <cstring>

using namespace std;



string s;

int pos,ans;



int main()

{

	cin>>s;

	pos=s.size()-1;

	

	while(pos>=0)

	{

		int cur=pos;

		while(s[cur]==s[pos]&&pos>=0) pos--;

		ans++;

	}

	

	cout<<ans-1;

	

	return 0;

}

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

#include<string.h>



int main()

{

    char s[100005];

    scanf("%s", s);

    int len = strlen(s);

    int ans = 0;

    for(int i = 1; i < len; 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 ans = 0;

    string inp;

    cin >> inp;

    for(int one = 1; one < inp.size(); one++){

        if(inp[one] != inp[one-1]){

            ans++;

        }

    }

    cout << ans;

}


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

#include<string.h>



int main()

{

    char s[100005];

    scanf("%s", s);

    int len = strlen(s);

    int ans = 0;

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

    {

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

            ans++;

    }

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



    return 0;

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

using namespace std;



using VS = vector<string>;    using LL = long long;

using VI = vector<int>;       using VVI = vector<VI>;

using PII = pair<int, int>;   using PLL = pair<LL, LL>;

using VL = vector<LL>;        using VVL = vector<VL>;



#define ALL(a)  begin((a)),end((a))

#define RALL(a) (a).rbegin(), (a).rend()

#define PB push_back

#define EB emplace_back

#define MP make_pair

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

#define SORT(c) sort(ALL((c)))

#define RSORT(c) sort(RALL((c)))

#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)

#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)

#define debug(x) cerr << #x << ": " << x << endl

const int INF = 1e9;                          const LL LINF = 1e16;

const LL MOD = 1000000007;                    const double PI = acos(-1.0);

int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };



/* -----  2018/02/14  Problem: 063_arc_a / Link: https://abc047.contest.atcoder.jp/tasks/arc063_a?lang=en  ----- */

/* ------問題------



きつねの次郎と三郎が一次元リバーシで遊んでいます。一次元リバーシでは、盤面には白か黒の石が一列に並んだ状態となっており、列の右端か左端に新たに石を打っていきます。通常のリバーシと同じように、たとえば白の石を打つことで黒の石を挟むと、挟まれた黒の石は白い石に変わります。

ゲームの途中で三郎に急用ができて帰ってしまうことになりました。このとき、盤面の状態は文字列 S で表されます。石は |S| (文字列の長さ) 個並んでおり、左から i (1≦i≦|S|) 個目の石の色は、S の i 文字目が B のとき黒、W のとき白です。

次郎は現在の盤面に対して、できるだけ少ない個数の石を新たに打つことで全ての石を同じ色にしようと考えました。最小で何個の石を打てばよいかを求めてください。



-----問題ここまで----- */

/* -----解説等-----







----解説ここまで---- */



LL N;



LL ans = 0LL;



int main() {

	cin.tie(0);

	ios_base::sync_with_stdio(false);



	string s;

	cin >> s;

	char t = s[0];

	FOR(i, 1, SZ(s)) {

		if (t != s[i]) {

			t = s[i];

			ans++;

		}

	}

	cout << ans << "\n";



	return 0;

}


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

#include<string.h>



int main()

{

    char s[100005];

    scanf("%s", s);

    int len = strlen(s);

    int ans = 0;

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

    {

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

            ans++;

    }

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



    return 0;

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

#include <stdlib.h>

#include <string.h>

#include <algorithm>

#include <cstdio> 

#define N 100000+5

using namespace std; 

int main(){

	char s[N];

	cin >> s;

	int ans=0;

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

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

			ans++;

		}

		else{

			continue;

		}

	} 

	cout << ans << endl;

	return 0;

}

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

#include<string.h>



int main()

{

    char s[100005];

    scanf("%s", s);

    int len = strlen(s);

    int ans = 0;

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

    {

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

            ans++;

    }

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



    return 0;

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

using namespace std; 

int main()

{

	char i[100001]="0";

	int c=0;

	cin>>i;

	for(int j=1;i[j]!='\0';j++) if(i[j]!=i[j-1]) c++;

	cout<<c;

	return 0;

}

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

using namespace std;

char str[100001];

int main(){

	int ans = 0; 

	scanf("%s",str);

	for(int i = 1;i<strlen(str);i++){

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

			ans += 1;

		}

	} 

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

	return 0;

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

using namespace std; 

int main()

{

	char i[100001]="0";

	int c=0;

	cin>>i;

	for(int j=1;i[j]!='\0';j++) if(i[j]!=i[j-1]) c++;

	cout<<c;

	return 0;

}

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

#define ll long long

using namespace std;

void put(int x){

	if(x<0) {

		putchar('-');

		x*=-1;

	}

	if(x==0) {

		putchar('0');

	}

	int num=0;

	char c[15];

	while(x) {

		c[++num]=(x%10)+48;

		x/=10;

	}

	while(num) {

		putchar(c[num--]);

	}

	putchar('\n');

}

inline void in(int &x){

	char ch=getchar();

	int flag=1;

	while(!(ch>='0'&&ch<='9')) {

		if(ch=='-')

			flag*=-1;

		ch=getchar();

	}

	x=ch-'0';

	ch=getchar();

	while(ch>='0'&&ch<='9') {

		x=((x<<3)+(x<<1))+ch-'0';

		ch=getchar();

	}

	x*=flag;

}

string a; int ans;

int main(){

	//freopen(".in","r",stdin);

	//freopen(".out","w",stdout);

	cin>>a;

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

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

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

	return 0;

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

using namespace std; 

int main()

{

	char i[100001]="0";

	int c=0;

	cin>>i;

	for(int j=1;i[j]!='\0';j++) if(i[j]!=i[j-1]) c++;

	cout<<c;

	return 0;

}

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

using namespace std;

int ans=0;

char last='\n',now;

int main(){

while((now=getchar())!='\n'){

    if(last=='\n'){  last=now; continue;

}

    

    if(last!=now)

    ans++;

		 last=now;

}

cout<<ans;

return 0;

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

using namespace std; 

int main()

{

	char i[100001]="0";

	int c=0;

	cin>>i;

	for(int j=1;i[j]!='\0';j++) if(i[j]!=i[j-1]) c++;

	cout<<c;

	return 0;

}

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

#include<cstdio>

#include<algorithm>

#include<string>

#include<cmath>

#include<cstdlib>

using namespace std;

int ans;

string str;

int main(){

	cin>>str;

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

	printf("%d",ans);

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

#include <string>

using namespace std;



string s;

int ans;



int main()

{

	cin>>s;

	int l=s.length();

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

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

	cout<<ans<<endl;

	return 0;

}

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

#include <cstring>



int main() {

	char ch[(int)1e5 << 1];

	scanf("%s", ch);

	int len = strlen(ch);

	int ans = 0;

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

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

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

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

#include<cstring>

using namespace std;



char a[100010];

int al,ans;



int main(){

	cin>>a; al=strlen(a);

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

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

			ans++;

	cout<<ans<<endl;

	return 0;

}

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

#include <cstring>



int main() {

	char ch[(int)1e5 << 1];

	scanf("%s", ch);

	int len = strlen(ch);

	int ans = 0;

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

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

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

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

using namespace std;

int main()

{

    char c,s='@';

    int ans=0;

    while(cin>>c)

    {

        if(c!=s&&s!='@')

            ans++;

        s=c;

    }

    cout<<ans<<endl;

    return 0;

}

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

#include <cstring>



int main() {

	char ch[(int)1e5 << 1];

	scanf("%s", ch);

	int len = strlen(ch);

	int ans = 0;

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

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

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

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

#include<cmath>

#include<iostream>

#include<string>

using namespace std;

string n;

int ans=0;

int main()

{

  cin>>n;

    int l=n.size();

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

    {

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

    }

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

    return 0;

}

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

#include <cstring>



int main() {

	char ch[(int)1e5 << 1];

	scanf("%s", ch);

	int len = strlen(ch);

	int ans = 0;

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

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

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

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

using namespace std;

char a[20060811];

int n,i,sum,la;

int main()

{

    cin>>a;

    la=strlen(a);

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

    {

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

            sum++;

        else

            continue;

    }

    cout<<sum<<endl;

    return 0;

}

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

#include <cstring>



int main() {

	char ch[(int)1e5 << 1];

	scanf("%s", ch);

	int len = strlen(ch);

	int ans = 0;

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

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

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

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



using namespace std ;



char s[ 100010 ] ;

int n ; 



int main() {

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

	n = strlen( s + 1 ) ;

	int cnt = 0 ;

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

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

			cnt ++ ;

			i ++ ;

			while( s[ i ] == s[ i - 1 ] ) i ++ ;

		} else i ++ ; 

	}

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

}


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

#include <cstring>



int main() {

	char ch[(int)1e5 << 1];

	scanf("%s", ch);

	int len = strlen(ch);

	int ans = 0;

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

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

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

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

#include<cstring>

using namespace std;

int main()

{

	string a;

	int b=0;

	cin>>a;

	for (int i=0;i<a.length();i++)

	{

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

		{

			b++;	

		}

	}

	cout<<b-1<<endl;

	return 0;

}

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

#include <cstring>



int main() {

	char ch[(int)1e5 << 1];

	scanf("%s", ch);

	int len = strlen(ch);

	int ans = 0;

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

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

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

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

using namespace std;

typedef long long ll;

string s;

ll ans;

int main()

{

	cin>>s;

	ll len=s.size();

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

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

	cout<<ans;

	return 0;

}

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

#include <cstring>



int main() {

	char ch[(int)1e5 << 1];

	scanf("%s", ch);

	int len = strlen(ch);

	int ans = 0;

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

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

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

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

#include <string>

using namespace std;



string s;

int ans;



int main()

{

	cin>>s;

	int l=s.length();

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

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

	cout<<ans<<endl;

	return 0;

}

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

const int MAXN=110000;

char s[MAXN];

int main()

{

//	freopen("C.in", "r", stdin);

//	freopen("C.out", "w", stdout);

	int ans=0;

	scanf("%s", s);

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

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

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

	return 0;

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

#include<cstring>

using namespace std;



char a[100010];

int al,ans;



int main(){

	cin>>a; al=strlen(a);

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

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

			ans++;

	cout<<ans<<endl;

	return 0;

}

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

const int MAXN=110000;

char s[MAXN];

int main()

{

//	freopen("C.in", "r", stdin);

//	freopen("C.out", "w", stdout);

	int ans=0;

	scanf("%s", s);

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

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

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

	return 0;

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

using namespace std;

int main()

{

    char c,s='@';

    int ans=0;

    while(cin>>c)

    {

        if(c!=s&&s!='@')

            ans++;

        s=c;

    }

    cout<<ans<<endl;

    return 0;

}

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

const int MAXN=110000;

char s[MAXN];

int main()

{

//	freopen("C.in", "r", stdin);

//	freopen("C.out", "w", stdout);

	int ans=0;

	scanf("%s", s);

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

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

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

	return 0;

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

#include<cmath>

#include<iostream>

#include<string>

using namespace std;

string n;

int ans=0;

int main()

{

  cin>>n;

    int l=n.size();

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

    {

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

    }

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

    return 0;

}

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

const int MAXN=110000;

char s[MAXN];

int main()

{

//	freopen("C.in", "r", stdin);

//	freopen("C.out", "w", stdout);

	int ans=0;

	scanf("%s", s);

	for (int i=1; s[i]; 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 a[20060811];

int n,i,sum,la;

int main()

{

    cin>>a;

    la=strlen(a);

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

    {

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

            sum++;

        else

            continue;

    }

    cout<<sum<<endl;

    return 0;

}

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

const int MAXN=110000;

char s[MAXN];

int main()

{

//	freopen("C.in", "r", stdin);

//	freopen("C.out", "w", stdout);

	int ans=0;

	scanf("%s", s);

	for (int i=1; s[i]; 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 s[ 100010 ] ;

int n ; 



int main() {

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

	n = strlen( s + 1 ) ;

	int cnt = 0 ;

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

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

			cnt ++ ;

			i ++ ;

			while( s[ i ] == s[ i - 1 ] ) i ++ ;

		} else i ++ ; 

	}

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

}


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

const int MAXN=110000;

char s[MAXN];

int main()

{

//	freopen("C.in", "r", stdin);

//	freopen("C.out", "w", stdout);

	int ans=0;

	scanf("%s", s);

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

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

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

	return 0;

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

#include<cstring>

using namespace std;

int main()

{

	string a;

	int b=0;

	cin>>a;

	for (int i=0;i<a.length();i++)

	{

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

		{

			b++;	

		}

	}

	cout<<b-1<<endl;

	return 0;

}

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

const int MAXN=110000;

char s[MAXN];

int main()

{

//	freopen("C.in", "r", stdin);

//	freopen("C.out", "w", stdout);

	int ans=0;

	scanf("%s", s);

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

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

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

	return 0;

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

using namespace std;

typedef long long ll;

string s;

ll ans;

int main()

{

	cin>>s;

	ll len=s.size();

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

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

	cout<<ans;

	return 0;

}

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

const int MAXN=110000;

char s[MAXN];

int main()

{

//	freopen("C.in", "r", stdin);

//	freopen("C.out", "w", stdout);

	int ans=0;

	scanf("%s", s);

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

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

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

	return 0;

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

#include<cstring>

using namespace std;

int main(){

	char a[100010];

	int ans=0;

	cin>>a;

	for(int i=1;i<=strlen(a);i++){

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

	}

	cout<<ans-1;

	return 0;

}


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

const int MAXN=110000;

char s[MAXN];

int main()

{

//	freopen("C.in", "r", stdin);

//	freopen("C.out", "w", stdout);

	int ans=0;

	scanf("%s", s);

	for (int i=1; s[i]; 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 ans;

    char a[100001];

    scanf("%s",a);

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

    {

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

            ans++;

    }

    cout<<ans<<endl;

    return 0;

}

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

const int MAXN=110000;

char s[MAXN];

int main()

{

//	freopen("C.in", "r", stdin);

//	freopen("C.out", "w", stdout);

	int ans=0;

	scanf("%s", s);

	for (int i=1; s[i]; 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()

{

string a;

int i=0;

cin>>a;

for(int k=1;k<a.size();k++)

{

	if(a[k-1]!=a[k])i++;

}

cout<<i<<endl;

}

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

const int MAXN=110000;

char s[MAXN];

int main()

{

//	freopen("C.in", "r", stdin);

//	freopen("C.out", "w", stdout);

	int ans=0;

	scanf("%s", s);

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

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

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

	return 0;

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

#include<cstring>

#include<cmath>

using namespace std;

int main(){

    string a;

    int sum=0;

    cin>>a;

    for(int i=1;i<a.length();i++){

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

            sum++;

        }

    }

    cout<<sum<<endl;

}

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

const int MAXN=110000;

char s[MAXN];

int main()

{

//	freopen("C.in", "r", stdin);

//	freopen("C.out", "w", stdout);

	int ans=0;

	scanf("%s", s);

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

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

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

	return 0;

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

using namespace std;

string s;

int main()

{

	int ans=0;

	cin>>s;

	int len=s.length();

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

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

	     ans++;

	cout<<ans<<endl;

	return 0;

}

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

const int MAXN=110000;

char s[MAXN];

int main()

{

//	freopen("C.in", "r", stdin);

//	freopen("C.out", "w", stdout);

	int ans=0;

	scanf("%s", s);

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

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

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

	return 0;

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

#include <cstring>

#include <iostream>

using namespace std;

const int mod = 1000000007;

const int N = 100005;

char s[N];

int main(){

	cin>>s;

	int len  = strlen(s);

	int ans = 0;

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

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

	}

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

	return 0;

}

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

#include<string.h>

int main()

{

	int n,i,k;

	char s[100005];

	scanf("%s",&s);

	k=strlen(s);

	n=1;

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

	{

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

		  n++;

	}

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

	return 0;

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

#include <cstring>

#include <iostream>

using namespace std;

const int mod = 1000000007;

const int N = 100005;

char s[N];

int main(){

	cin>>s;

	int len  = strlen(s);

	int ans = 0;

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

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

	}

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

	return 0;

}

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

#include<cstring>

#include<algorithm>

#define MAXN 100006

using namespace std;

char str[MAXN];

int main()

{

	while(~scanf("%s",str))

	{

		int len=strlen(str);

		int num=0;

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

		{

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

				num++;	

		}

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

	}

	return 0;

}