stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}


// Optimized solution to the same problem (faster):
#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;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}


// Optimized solution to the same problem (faster):
#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;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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 ) ;

}


// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}


// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<cstdio>

#include<iostream>

#include<cstring>

#include<stack>

using namespace std;

char str[100005];

int main()

{

	int ans=0;

	stack<char > sta;

	scanf("%s",str);

	int num;

	num = strlen(str);

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

	 sta.push(str[i]);

	char top;

	top=sta.top();

	sta.pop();

	while(!sta.empty())

	{

		if(top==sta.top())

       {

		sta.pop();

	  }

	  else

	  {

	   ans++;

	   top=sta.top();	

	  }

		

	}

	

	 

	cout<<ans<<endl;

  return 0; 

	

	

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<cstdio>

#include<cstdlib>

#include<cstring>

#include<cmath>

#include<iostream>

#include<algorithm>

using namespace std;

int main()

{

	char s[100010];

	while(scanf("%s",s)!=EOF)

	{

		int n,ans;

		ans=0;

		n=strlen(s);

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

		{

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

				ans++;

		}

		cout<<ans<<endl;

	}

return 0;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

int main()

{

	char s[100010];

	while(scanf("%s",s)!=EOF)

	{

		int l=strlen(s);

		int sum=0;

//		int flag=1;

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

		{

//			if(s[i]!='W'||s[i]!='B')

//			{

//				flag=0;

//				break;

//			}

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

			sum++;

		}

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

//		if(flag==1)

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

//		else

//		printf("0\n");

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <string>



using namespace std;



int main()

{

    string s; cin >> s;

    int r = 0;

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

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

            ++r;

    cout << r << endl;

    return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cmath>

#include<algorithm>

#include<cstring>

#include<string>

using namespace std;

int main()

{	

    int n,i,ans=0,ant=0;

	char str[110000];

	scanf("%s",&str);

	n=strlen(str);

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

	{

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

		 ans+=1;

	}



	  printf("%d",ans);

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



using namespace std;





int main() { 

    string s;

    while (cin >> s) {

        int n = s.length();

        int cnt = 0;

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

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

        }

        cout << cnt << "\n";

    }



    return 0;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cmath>

#include<algorithm>

#include<cstring>

#include<string>

using namespace std;

int main()

{	

    int n,i,ans=0,ant=0;

	char str[110000];

	scanf("%s",&str);

	n=strlen(str);

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

	{

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

		 ans+=1;

	}



	  printf("%d",ans);

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <algorithm>

#include <cmath>

#include <iostream>

#include <string>

using namespace std;



int main() {

  string s;

  cin >> s;

  

  int count = 0;

  char curr = s[0];

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

    if(s[i] != curr) count++;

    curr = s[i];

  }

  

  cout << count << endl;

  

  return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cmath>

#include<algorithm>

#include<cstring>

#include<string>

using namespace std;

int main()

{	

    int n,i,ans=0,ant=0;

	char str[110000];

	scanf("%s",&str);

	n=strlen(str);

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

	{

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

		 ans+=1;

	}



	  printf("%d",ans);

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<string>



using namespace std;



int main() {

  string s;

  cin >> s;

  int groups = 1;

  char prev = 'E';

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

    if(prev != 'E' && prev !=s[i]) {

      groups++;

    }

    prev = s[i];

  }

  groups--;

  cout << groups;



  return 0;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cmath>

#include<algorithm>

#include<cstring>

#include<string>

using namespace std;

int main()

{	

    int n,i,ans=0,ant=0;

	char str[110000];

	scanf("%s",&str);

	n=strlen(str);

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

	{

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

		 ans+=1;

	}



	  printf("%d",ans);

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <string>



using namespace std;





int main() {

	string board;

	cin >> board;



	int count = 0;



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

		if(board[i] != board[i + 1]) {

			count++;

		}

	}



	cout << count << endl;

	return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cmath>

#include<algorithm>

#include<cstring>

#include<string>

using namespace std;

int main()

{	

    int n,i,ans=0,ant=0;

	char str[110000];

	scanf("%s",&str);

	n=strlen(str);

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

	{

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

		 ans+=1;

	}



	  printf("%d",ans);

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



string s;

int ans;



int main()

{

    ios_base::sync_with_stdio(0); cin.tie(0);

    cin >> s;



    char now = s[0];

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

        if(s[i]!=now) {

            now = s[i];

            ans++;

        }

    }

    cout << ans << endl;



    return 0;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cmath>

#include<algorithm>

#include<cstring>

#include<string>

using namespace std;

int main()

{	

    int n,i,ans=0,ant=0;

	char str[110000];

	scanf("%s",&str);

	n=strlen(str);

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

	{

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

		 ans+=1;

	}



	  printf("%d",ans);

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

const int Max = 1E5 + 10;

char S[Max];

int main()

{

    cin>>S;

    int N=strlen(S),sum=0;

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

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

    cout<<sum<<endl;

	return 0;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cmath>

#include<algorithm>

#include<cstring>

#include<string>

using namespace std;

int main()

{	

    int n,i,ans=0,ant=0;

	char str[110000];

	scanf("%s",&str);

	n=strlen(str);

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

	{

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

		 ans+=1;

	}



	  printf("%d",ans);

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#pragma GCC optimize("O2,Ofast,inline,unroll-all-loops,-ffast-math")

#include <bits/stdc++.h>

using namespace std;

const int MAXN=1e5;

int st[10*MAXN];

int flag;

int insert(int root,int l,int r,int ql,int qr){

	//cerr<<l<<" "<<r<<endl;

	if(l>qr || r<ql)return st[root];

	if(l==r ){

		if(st[root]==1){

			flag=0;

			

		}

		else {

		st[root]=1;

		flag=1;

		}

		return 1;

	}

	int m=l+(r-l)/2;

	int rt=(root<<1)+1;

	int lf=root<<1;

	if(!st[rt]){

		int val=insert(rt,m+1,r,ql,qr);

		st[root]=min(st[lf],val);

		if(flag)

	return st[root];

	}

	if(!st[lf]){

		int val=insert(lf,l,m,ql,qr);

		st[root]=min(st[rt],val);

		if(flag)

		return st[root];

	}

	flag=0;

	return st[root];

	

}

int main(){

	int n,m;cin>>n>>m;

	vector<pair<int,int>> arrmv;

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

		int a,b;cin>>a>>b;

		arrmv.push_back(make_pair(b,a));

	}

	sort(arrmv.begin(),arrmv.end(),greater<pair<int,int>>());

	int ans=0;

	memset(st,0,sizeof(st));

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

		int l=m- (arrmv[i].second-1);

		if(l<=0)continue;

		flag=0;

		 insert(1,1,m,1,l);

		 //for(int j=1;j<=7;j++)cerr<<st[j]<<" ";

		 //cerr<<endl;

		if(flag)ans+=arrmv[i].first;

		else continue;

	}

	

	cout<<ans<<endl;

	return 0;

}


// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

using namespace std;

const int maxn=1e5+5;

vector<int>v[maxn];

priority_queue<int>q;

int main()

{

    int n,m;

    scanf("%d%d",&n,&m);

    cerr<<n<<" "<<m<<endl;

    int a,b;

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

        scanf("%d%d",&a,&b);

        v[a].push_back(b);

    }

    int ans=0;

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

        for(auto c:v[i]) q.push(c);

        if(!q.empty()){

            ans+=q.top();

            q.pop();

        }

    }

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

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



using namespace std;

const int N = 1e5 + 3;

vector<int> job[N];

int main() {

#ifndef ONLINE_JUDGE

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

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

#endif

	int n, m;

	scanf("%d %d", &n, &m);

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

		int a, b;

		scanf("%d %d", &a, &b);

		if (m >= a)

			job[m - a].push_back(b);

	}

	long long res = 0;

	priority_queue<int> pq;

	for (int i = m; i >= 0; --i) {

		for (auto v: job[i])

			pq.push(v);

		if (pq.size()) {

			res += pq.top();

			pq.pop();

		}

	}

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

	return 0;

}


// Optimized solution to the same problem (faster):
// D- Summer vacation- atcoder.cpp : This file contains the 'main' function. Program execution begins and ends there.

//



#include <iostream>

#include <deque>

#include <set>

#include <algorithm>

using namespace std;

const int N = 1e5 , M = 1e5  ;

int n, m , u , v;

deque <pair<int, int>> Q;

int ans = 0;



int main()

{

	cin >> n >> m ;



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

		cin >> u >> v;

		Q.push_back(make_pair(u, v));

	}



	sort(Q.begin(), Q.end());

	multiset<int> s;

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

	{

		int size = Q.size();

		for(int j = 0 ; j < size ;j++){

			if (Q.front().first == i)

			{

				s.insert(Q.front().second);

				Q.pop_front();

			}

			else break;

		}

		if (!s.empty()) {

			ans += *--s.end() ;

			s.erase(--s.end()) ;

		}

	}

	cout << ans;

}


// Fastest known solution for this problem: