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

const int N = 100010;



char s[N];



int main()

{

int aa;

    scanf("%s", s);

    int cnt = 0, len = strlen(s);

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

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

            cnt ++;

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

    return 0;

}

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

#include <cstdlib>

#include <cstring>

#include <algorithm>

using namespace std;

const int N = 1e5 + 5;

char s[N];

int main(){ 

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

    int len = strlen(s + 1);

    int ans = 0;

    s[0] = s[1];

    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>

#define rep(i,a,b) for(int i=a;i<=b;i++)

#define per(i,a,b) for(int i=a;i>=b;i--)

#define gpf(...) fprintf(stderr,__VA_ARGS__)

using namespace std;

typedef long long ll;



char st[110000];

int len;



int main(){

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

	len = strlen(st + 1);

	int ans = 0;

	rep(i, 2, len) if (st[i] != st[i - 1]) ans++;

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

	return 0;

}

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

#include <cstdlib>

#include <cstring>

#include <algorithm>

using namespace std;

const int N = 1e5 + 5;

char s[N];

int main(){ 

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

    int len = strlen(s + 1);

    int ans = 0;

    s[0] = s[1];

    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>

#define rep(i,a,n) for(int _tmp=n,i=a;i<=_tmp;++i)

#define dep(i,a,n) for(int _tmp=n,i=a;i>=_tmp;--i)

#define re(i,a,n) for(int _tmp=n,i=a;i<_tmp;++i)

#define fec(i,a) for(__typeof a.begin() i=a.begin();i!=a.end();++i)

#define For(i,v,u) for(int i=H[u],v=to[i];i;i=nxt[i],v=to[i])

#define si(x) (int)x.size()

#define pb push_back

#define mp make_pair

#define mt make_tuple

#define X first

#define Y second

#define inf 1000000000

using namespace std;

template<class T> inline void read(T&x){char c;bool fu=0;for(c=getchar();c<=32;c=getchar());if(c=='-')fu=1,c=getchar();for(x=0;c>32;c=getchar())x=x*10+c-'0';if(fu)x*=-1;}

template<class T> inline void read(T&x,T&y){read(x);read(y);}

template<class T> inline void read(T&x,T&y,T&z) {read(x,y);read(z);}

template<class T> inline void MAX(T&x,T y){if(x<y)x=y;}

template<class T> inline void MIN(T&x,T y){if(x>y)x=y;}

typedef long long ll;

typedef pair<int,int> pii;

typedef tuple<int,int,int> tiii;

const int N=111111;

//head

int cnt;

char s[N];

int main() {

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

	rep(i,1,len)if(s[i]!=s[i-1])++cnt;

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

	return 0;

}

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

#include <cstdlib>

#include <cstring>

#include <algorithm>

using namespace std;

const int N = 1e5 + 5;

char s[N];

int main(){ 

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

    int len = strlen(s + 1);

    int ans = 0;

    s[0] = s[1];

    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;

const int N = 1e5 + 5;

char s[N];

int main() {

	int n;

	scanf("%s", s);

	int ans = 0;

	n = strlen(s);

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

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

	}

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

}




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

#include <cstdlib>

#include <cstring>

#include <algorithm>

using namespace std;

const int N = 1e5 + 5;

char s[N];

int main(){ 

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

    int len = strlen(s + 1);

    int ans = 0;

    s[0] = s[1];

    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<cstring>

using namespace std;

char s[101010];

int main()

{

	cin>>s+1;

	int n=strlen(s+1);

	int ans=0;

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

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

			ans++;

	cout<<ans<<endl;

	return 0;

}

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

#include <cstdlib>

#include <cstring>

#include <algorithm>

using namespace std;

const int N = 1e5 + 5;

char s[N];

int main(){ 

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

    int len = strlen(s + 1);

    int ans = 0;

    s[0] = s[1];

    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 <fstream>

#include <vector>

#include <string>

#include <algorithm>

#include <cmath>

#include <cstdlib>

using namespace std;

#define mod 1000000007



int main()

{

	//freopen("test", "r", stdin);

	string s; cin >> s;

	int ret = 0;

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

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

			++ret;

		}

	}

	cout << ret << '\n';

	return 0;

}

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

#include <cstdlib>

#include <cstring>

#include <algorithm>

using namespace std;

const int N = 1e5 + 5;

char s[N];

int main(){ 

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

    int len = strlen(s + 1);

    int ans = 0;

    s[0] = s[1];

    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;



char s[100010];

int n;



int main()

{

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

	n = strlen(s + 1);

	int ans = 0;

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

	{

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

	}

	cout << ans - 1 << endl;

	return 0;

}

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

#include <cstdlib>

#include <cstring>

#include <algorithm>

using namespace std;

const int N = 1e5 + 5;

char s[N];

int main(){ 

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

    int len = strlen(s + 1);

    int ans = 0;

    s[0] = s[1];

    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>

const int N = 100010;



char s[N];



int main()

{

int aa;

    scanf("%s", s);

    int cnt = 0, len = strlen(s);

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

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

            cnt ++;

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

    return 0;

}

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

#include<cstdlib>

#include<cstring>

#include<algorithm>

using namespace std;

const int nMax=1e5+10;

int cnt=0;

char s[nMax];

int main()

{

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

	int len=strlen(s+1);

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

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

			cnt++;

	cnt++;

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

	return 0;

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

#define rep(i,a,b) for(int i=a;i<=b;i++)

#define per(i,a,b) for(int i=a;i>=b;i--)

#define gpf(...) fprintf(stderr,__VA_ARGS__)

using namespace std;

typedef long long ll;



char st[110000];

int len;



int main(){

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

	len = strlen(st + 1);

	int ans = 0;

	rep(i, 2, len) if (st[i] != st[i - 1]) ans++;

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

	return 0;

}

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

#include<cstdlib>

#include<cstring>

#include<algorithm>

using namespace std;

const int nMax=1e5+10;

int cnt=0;

char s[nMax];

int main()

{

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

	int len=strlen(s+1);

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

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

			cnt++;

	cnt++;

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

	return 0;

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

#define rep(i,a,n) for(int _tmp=n,i=a;i<=_tmp;++i)

#define dep(i,a,n) for(int _tmp=n,i=a;i>=_tmp;--i)

#define re(i,a,n) for(int _tmp=n,i=a;i<_tmp;++i)

#define fec(i,a) for(__typeof a.begin() i=a.begin();i!=a.end();++i)

#define For(i,v,u) for(int i=H[u],v=to[i];i;i=nxt[i],v=to[i])

#define si(x) (int)x.size()

#define pb push_back

#define mp make_pair

#define mt make_tuple

#define X first

#define Y second

#define inf 1000000000

using namespace std;

template<class T> inline void read(T&x){char c;bool fu=0;for(c=getchar();c<=32;c=getchar());if(c=='-')fu=1,c=getchar();for(x=0;c>32;c=getchar())x=x*10+c-'0';if(fu)x*=-1;}

template<class T> inline void read(T&x,T&y){read(x);read(y);}

template<class T> inline void read(T&x,T&y,T&z) {read(x,y);read(z);}

template<class T> inline void MAX(T&x,T y){if(x<y)x=y;}

template<class T> inline void MIN(T&x,T y){if(x>y)x=y;}

typedef long long ll;

typedef pair<int,int> pii;

typedef tuple<int,int,int> tiii;

const int N=111111;

//head

int cnt;

char s[N];

int main() {

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

	rep(i,1,len)if(s[i]!=s[i-1])++cnt;

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

	return 0;

}

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

#include<cstdlib>

#include<cstring>

#include<algorithm>

using namespace std;

const int nMax=1e5+10;

int cnt=0;

char s[nMax];

int main()

{

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

	int len=strlen(s+1);

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

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

			cnt++;

	cnt++;

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

	return 0;

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

using namespace std;

const int N = 1e5 + 5;

char s[N];

int main() {

	int n;

	scanf("%s", s);

	int ans = 0;

	n = strlen(s);

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

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

	}

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

}




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

#include<cstdlib>

#include<cstring>

#include<algorithm>

using namespace std;

const int nMax=1e5+10;

int cnt=0;

char s[nMax];

int main()

{

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

	int len=strlen(s+1);

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

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

			cnt++;

	cnt++;

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

	return 0;

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

#include<cstring>

using namespace std;

char s[101010];

int main()

{

	cin>>s+1;

	int n=strlen(s+1);

	int ans=0;

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

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

			ans++;

	cout<<ans<<endl;

	return 0;

}

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

#include<cstdlib>

#include<cstring>

#include<algorithm>

using namespace std;

const int nMax=1e5+10;

int cnt=0;

char s[nMax];

int main()

{

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

	int len=strlen(s+1);

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

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

			cnt++;

	cnt++;

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

	return 0;

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

#include <fstream>

#include <vector>

#include <string>

#include <algorithm>

#include <cmath>

#include <cstdlib>

using namespace std;

#define mod 1000000007



int main()

{

	//freopen("test", "r", stdin);

	string s; cin >> s;

	int ret = 0;

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

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

			++ret;

		}

	}

	cout << ret << '\n';

	return 0;

}

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

#include<cstdlib>

#include<cstring>

#include<algorithm>

using namespace std;

const int nMax=1e5+10;

int cnt=0;

char s[nMax];

int main()

{

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

	int len=strlen(s+1);

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

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

			cnt++;

	cnt++;

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

	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 ans = 0;

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

	{

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

	}

	cout << ans - 1 << endl;

	return 0;

}

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

#include<cstdlib>

#include<cstring>

#include<algorithm>

using namespace std;

const int nMax=1e5+10;

int cnt=0;

char s[nMax];

int main()

{

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

	int len=strlen(s+1);

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

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

			cnt++;

	cnt++;

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

	return 0;

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

using namespace std;



char s[100005];

int len;





int main()

{

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

	len = strlen(s + 1);

	int ans1 = 0;

	for(int i = len; i; i--)

	{

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

		{

			ans1++;

		}

	}

	ans1--;

	int ans2 = 0;

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

	{

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

		{

			ans2++;

		}

	}

	ans2--;

	printf("%d\n", min(ans1, ans2));

	

	return 0;

}

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

#include<cstdlib>

#include<cstring>

#include<algorithm>

using namespace std;

const int nMax=1e5+10;

int cnt=0;

char s[nMax];

int main()

{

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

	int len=strlen(s+1);

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

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

			cnt++;

	cnt++;

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

	return 0;

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

const int N = 100010;



char s[N];



int main()

{

int aa;

    scanf("%s", s);

    int cnt = 0, len = strlen(s);

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

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

            cnt ++;

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

    return 0;

}

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

#include <cstring>

#include <algorithm>

#include <cmath>

#include <vector>

#include <queue>

using namespace std;

typedef long long LL;

typedef long double DD;

const int inf = 1e9;

const int mo= 1e9+7;

const int N = 200010;

char s[N];





int main(){

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

	int n=strlen(s+1);

	int ans=0;

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

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

			ans++;

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

	return 0;

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

#define rep(i,a,b) for(int i=a;i<=b;i++)

#define per(i,a,b) for(int i=a;i>=b;i--)

#define gpf(...) fprintf(stderr,__VA_ARGS__)

using namespace std;

typedef long long ll;



char st[110000];

int len;



int main(){

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

	len = strlen(st + 1);

	int ans = 0;

	rep(i, 2, len) if (st[i] != st[i - 1]) ans++;

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

	return 0;

}

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

#include <cstring>

#include <algorithm>

#include <cmath>

#include <vector>

#include <queue>

using namespace std;

typedef long long LL;

typedef long double DD;

const int inf = 1e9;

const int mo= 1e9+7;

const int N = 200010;

char s[N];





int main(){

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

	int n=strlen(s+1);

	int ans=0;

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

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

			ans++;

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

	return 0;

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

#define rep(i,a,n) for(int _tmp=n,i=a;i<=_tmp;++i)

#define dep(i,a,n) for(int _tmp=n,i=a;i>=_tmp;--i)

#define re(i,a,n) for(int _tmp=n,i=a;i<_tmp;++i)

#define fec(i,a) for(__typeof a.begin() i=a.begin();i!=a.end();++i)

#define For(i,v,u) for(int i=H[u],v=to[i];i;i=nxt[i],v=to[i])

#define si(x) (int)x.size()

#define pb push_back

#define mp make_pair

#define mt make_tuple

#define X first

#define Y second

#define inf 1000000000

using namespace std;

template<class T> inline void read(T&x){char c;bool fu=0;for(c=getchar();c<=32;c=getchar());if(c=='-')fu=1,c=getchar();for(x=0;c>32;c=getchar())x=x*10+c-'0';if(fu)x*=-1;}

template<class T> inline void read(T&x,T&y){read(x);read(y);}

template<class T> inline void read(T&x,T&y,T&z) {read(x,y);read(z);}

template<class T> inline void MAX(T&x,T y){if(x<y)x=y;}

template<class T> inline void MIN(T&x,T y){if(x>y)x=y;}

typedef long long ll;

typedef pair<int,int> pii;

typedef tuple<int,int,int> tiii;

const int N=111111;

//head

int cnt;

char s[N];

int main() {

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

	rep(i,1,len)if(s[i]!=s[i-1])++cnt;

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

	return 0;

}

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

#include <cstring>

#include <algorithm>

#include <cmath>

#include <vector>

#include <queue>

using namespace std;

typedef long long LL;

typedef long double DD;

const int inf = 1e9;

const int mo= 1e9+7;

const int N = 200010;

char s[N];





int main(){

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

	int n=strlen(s+1);

	int ans=0;

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

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

			ans++;

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

	return 0;

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

using namespace std;

const int N = 1e5 + 5;

char s[N];

int main() {

	int n;

	scanf("%s", s);

	int ans = 0;

	n = strlen(s);

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

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

	}

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

}




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

#include <cstring>

#include <algorithm>

#include <cmath>

#include <vector>

#include <queue>

using namespace std;

typedef long long LL;

typedef long double DD;

const int inf = 1e9;

const int mo= 1e9+7;

const int N = 200010;

char s[N];





int main(){

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

	int n=strlen(s+1);

	int ans=0;

	for(int i=2;i<=n;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 s[101010];

int main()

{

	cin>>s+1;

	int n=strlen(s+1);

	int ans=0;

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

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

			ans++;

	cout<<ans<<endl;

	return 0;

}

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

#include <cstring>

#include <algorithm>

#include <cmath>

#include <vector>

#include <queue>

using namespace std;

typedef long long LL;

typedef long double DD;

const int inf = 1e9;

const int mo= 1e9+7;

const int N = 200010;

char s[N];





int main(){

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

	int n=strlen(s+1);

	int ans=0;

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

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

			ans++;

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

	return 0;

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

#include <fstream>

#include <vector>

#include <string>

#include <algorithm>

#include <cmath>

#include <cstdlib>

using namespace std;

#define mod 1000000007



int main()

{

	//freopen("test", "r", stdin);

	string s; cin >> s;

	int ret = 0;

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

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

			++ret;

		}

	}

	cout << ret << '\n';

	return 0;

}

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

#include <cstring>

#include <algorithm>

#include <cmath>

#include <vector>

#include <queue>

using namespace std;

typedef long long LL;

typedef long double DD;

const int inf = 1e9;

const int mo= 1e9+7;

const int N = 200010;

char s[N];





int main(){

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

	int n=strlen(s+1);

	int ans=0;

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

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

	{

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

	}

	cout << ans - 1 << endl;

	return 0;

}

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

#include <cstring>

#include <algorithm>

#include <cmath>

#include <vector>

#include <queue>

using namespace std;

typedef long long LL;

typedef long double DD;

const int inf = 1e9;

const int mo= 1e9+7;

const int N = 200010;

char s[N];





int main(){

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

	int n=strlen(s+1);

	int ans=0;

	for(int i=2;i<=n;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[100005];

int len;





int main()

{

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

	len = strlen(s + 1);

	int ans1 = 0;

	for(int i = len; i; i--)

	{

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

		{

			ans1++;

		}

	}

	ans1--;

	int ans2 = 0;

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

	{

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

		{

			ans2++;

		}

	}

	ans2--;

	printf("%d\n", min(ans1, ans2));

	

	return 0;

}

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

#include <cstring>

#include <algorithm>

#include <cmath>

#include <vector>

#include <queue>

using namespace std;

typedef long long LL;

typedef long double DD;

const int inf = 1e9;

const int mo= 1e9+7;

const int N = 200010;

char s[N];





int main(){

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

	int n=strlen(s+1);

	int ans=0;

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

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

			ans++;

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

	return 0;

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

using namespace std;



const int N = 100000 + 10;



int n;

char ss[N];



int main() {

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

	n = (int)strlen( ss + 1 );

	int tot = 0;

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

		for( j = i; j + 1 <= n && ss[j+1] == ss[i]; j++ );

		tot++;

	}

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

}




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

#include <cstring>

#include <algorithm>

#include <cmath>

#include <vector>

#include <queue>

using namespace std;

typedef long long LL;

typedef long double DD;

const int inf = 1e9;

const int mo= 1e9+7;

const int N = 200010;

char s[N];





int main(){

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

	int n=strlen(s+1);

	int ans=0;

	for(int i=2;i<=n;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 st[112345];

int main(){

	scanf("%s",st);

	int n = strlen(st);

	int ans = 0;

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

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

	}

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

}

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

#include <cstring>

#include <algorithm>

#include <cmath>

#include <vector>

#include <queue>

using namespace std;

typedef long long LL;

typedef long double DD;

const int inf = 1e9;

const int mo= 1e9+7;

const int N = 200010;

char s[N];





int main(){

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

	int n=strlen(s+1);

	int ans=0;

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

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

			ans++;

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

	return 0;

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

#include<cstdio>

#include<algorithm>

#include<cmath>

#include<cstring>

#include<map>

using namespace std;

int main(){

	char s[105000];

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

	int n = strlen(s + 1);

	char cur = s[1];int ans = 0;

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

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

	cout<<ans;

	return 0;

}

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

#include <cstring>

#include <algorithm>

#include <cmath>

#include <vector>

#include <queue>

using namespace std;

typedef long long LL;

typedef long double DD;

const int inf = 1e9;

const int mo= 1e9+7;

const int N = 200010;

char s[N];





int main(){

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

	int n=strlen(s+1);

	int ans=0;

	for(int i=2;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 <algorithm>

#include <cstdio>

#include <queue>

#include <ctype.h>

#include <set>

#include <map>

#include <list>

#include <stack>



using namespace std;

char s[100500];

int main()

{

    scanf("%s",s);

	int ans=0;

	int zhen=0;

	int len=strlen(s);

	while(zhen<len)

	{

		ans++;

		int tmp=s[zhen];

		while(s[zhen]==tmp)

		{

			zhen++;

		}

	}

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

	return 0;

}

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

#include <cstring>

#include <algorithm>

#include <cmath>

#include <vector>

#include <queue>

using namespace std;

typedef long long LL;

typedef long double DD;

const int inf = 1e9;

const int mo= 1e9+7;

const int N = 200010;

char s[N];





int main(){

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

	int n=strlen(s+1);

	int ans=0;

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

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

			ans++;

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

	return 0;

}