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

using namespace std;





int main(void)

{

    ios_base::sync_with_stdio(false);

    cin.tie(0);

    cout.tie(0);

    int n;

    cin >> n;

    int a[n];

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

    {

        cin >> a[i];

    }

    int count = 1;

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

    {

        if(a[i] < a[i-1])

            count++;

        else

            a[i] = a[i-1];

    }

    cout << count;

}


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



int main()

{

    int a,x=1,b,i=0;



    scanf("%d",&a);



    int A[a];



    while(i<a){

        scanf("%d",&A[i]);

        i++;

    }



    b=A[0];

    i=1;



    while(i<a){



        if(A[i]<b)

        {

            b=A[i];

            x++;



        }



        i++;

    }



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



    return 0;

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



using namespace std;



int main()

{

    long long n;

    long long num[1000000];

    long long min1;

    long long sum=0;

    cin>>n;

    cin>>num[0];

    min1=num[0];

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

    {

        cin>>num[i];

        if(num[i]<min1)

            {

                sum++;

                min1=num[i];

            }

    }

    cout<<sum+1<<endl;

    return 0;

}

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



using namespace std;

#define pi acos(-1)

#define _terminated return 0

#define endl "\n"

#define yes cout << "yes" << endl 

#define no cout << "no" << endl 

#define booster ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);





typedef long long ll;

typedef unsigned long long ull;

typedef vector<int> vi;

typedef vector<ll> vll;

typedef vector<vector<long> > v2l;



const int mod = 1e+5;

const int mx = 2e+5;

const ll inf = 1e18;



void upper_bubble_sort(){

     int i,j,temp,number_of_input;

     int array[100];

     cin >> number_of_input;

     for(i=0; i<number_of_input; i++)

         cin >> array[i];

         for(i=0; i<number_of_input; i++){

             for(j=0; j<(number_of_input-i-1); j++){

               if(array[j] > array[j+1]){

                 temp = array[j];

                 array[j] = array[j+1];

                 array[j+1] = temp;

                }

              }

         }

    for(i=0; i<number_of_input; i++)

      cout << array[i] << endl;

}

void bst(void){

          int low,high,mid,keynum,num,array[100];

          cin >> keynum;

          low = 1;

	         high = num;

         	do{

		        mid = (low + high) / 2;

		         if(keynum < array[mid])

			         high = mid - 1;

		         else if (keynum > array[mid])

			         low = mid + 1;

	         } 

          while (keynum != array[mid] && low <= high);

	        if(keynum == array[mid]){

            cout << "number located at " << mid +1 << endl;}

         else

           no;

        }



int solvio1(int p){

     while (p >= 10) 

     p /= 10; 

     return p; 

} 

void solve(){ 

    int N,P,i; 

    int ans = INT_MAX;

    cin >> N;

    int cnt = 0;

    for(i=0; i<N; i++){ 

       cin >> P; 

       if(P <= ans){ 

          ans = P; 

          cnt++; 

       } 

     } 

    cout << cnt << endl;

}

    

int main(){

    booster;

    solve();

    _terminated;

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



using namespace std;



int main()

{

    long long n;

    long long num[1000000];

    long long min1;

    long long sum=0;

    cin>>n;

    cin>>num[0];

    min1=num[0];

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

    {

        cin>>num[i];

        if(num[i]<min1)

            {

                sum++;

                min1=num[i];

            }

    }

    cout<<sum+1<<endl;

    return 0;

}

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

using namespace std;

int main()

{

    int n;

    cin>>n;

    int a[n],c=0,q,i;

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

    {

        cin>>a[i];



    }

    q=a[0];



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

    {



        if(q>=a[i])

        {

            c++;

            q=a[i];

        }





    }

    cout<<c+1;

















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



using namespace std;



int main()

{

    long long n;

    long long num[1000000];

    long long min1;

    long long sum=0;

    cin>>n;

    cin>>num[0];

    min1=num[0];

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

    {

        cin>>num[i];

        if(num[i]<min1)

            {

                sum++;

                min1=num[i];

            }

    }

    cout<<sum+1<<endl;

    return 0;

}

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

using namespace std;

int main()

{

      ios::sync_with_stdio(false);

      cin.tie(0);

   long long int i,n,x,k=0,input;

    cin>>n;

    x=n+1;

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

        cin>>input;

        if(input<x){

            k++;

            x=input;

        }

    }

    cout<<k<<"\n";

    return 0;

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

#include <queue>

using namespace std;



priority_queue<int, vector<int>, greater<int> > pq;



int main(void)

{

    int n, p, ans = 0;



    scanf("%d" ,&n);

    pq.push(n + 1);

    while (n--)

    {

        scanf("%d" ,&p);



        if (pq.top() >= p)

            ++ans;



        pq.push(p);

    }



    printf("%d" ,ans);

    return 0;

}

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



int main(void)

{

    int n, p, ans = 0, mini = 222222;



    scanf("%d" ,&n);

    while (n--)

    {

        scanf("%d" ,&p);



        if (mini >= p)

            ++ans;



        if (mini > p)

			mini = p;

    }



    printf("%d" ,ans);

    return 0;

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

#include <cstdio>

#include <cstdlib>

#include <cstring>

#include <iostream>

#include <algorithm>

using namespace std;



const int maxn =300003, INF = 0x7f7f7f7f;

int low[maxn], a[maxn];

int n, ans;



int binary_search(int *a, int r, int x)

//二分查找，返回a数组中第一个>=x的位置

{

    int l = 1, mid;

    while(l <= r)

    {

        mid = (l+r) >> 1;

        if(a[mid] <= x)

            l = mid + 1;

        else

            r = mid - 1;

    }

    return l;

}



int main()

{

    scanf("%d", &n);

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

    {

        scanf("%d", &a[i]);

        low[i] = INF;   //由于low中存的是最小值，所以low初始化为INF

    }

    low[1] = a[1];

    ans = 1;   //初始时LIS长度为1

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

    {

        if(a[i] < low[ans])    //若a[i]>=low[ans]，直接把a[i]接到后面

            low[++ans] = a[i];

        else       //否则，找到low中第一个>=a[i]的位置low[j]，用a[i]更新low[j]

            low[binary_search(low, ans, a[i])] = a[i];

    }

    printf("%d\n", ans);   //输出答案

    return 0;

}


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

#include<cstring>

#include<algorithm>

using namespace std;

int ma[400008],fa[400008];

int main(){

    int n;

    scanf("%d",&n);

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

        scanf("%d",ma+i);

    int len=1,mi=ma[0];

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

        if(mi>ma[i])

            mi=ma[i],len++;

    }

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

}
// Slower C++ solution:
// https://github.com/atcoder-live/library

#include <bits/stdc++.h>

using namespace std;

using ll = long long;

using vi = vector<int>;

using vvi = vector<vi>;

#define ote(x) cout<<(x)<<endl

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

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

#define rpz(i,e) rp(i,0,(e))

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

#define irpz(i,s) irp(i,(s),-1)

template<class T> T in(){T x;cin>>x;return x;}

// long long a = in<long long>();

template<class T> void inarr(int s,int e,T &v){rp(i,s,e)cin>>v[i];}

// inarr<vi>(0,N,V);

#define NMAX 1000000

int N;

vi P(NMAX);



int solve(){

	int ans=0;

	int minP = INT_MAX;

	rpz(i,N){

		if(minP>=P[i]){

			minP = P[i];

			ans++;

		}

		else{



		}

	}

	return ans;

}



int main(){

	cin>>N;

	rpz(i,N) cin>>P[i];

	ote(solve());

}


// Faster C++ solution for the same problem (measured speedup: 5.06856076602004x):
// C - Low Elements

#include <bits/stdc++.h>

using namespace std;

using vi = vector<int>;

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

template<class T> T in(){T x;cin>>x;return x;}

template<class T> vector<T> inarr(int s,int e, T init){

	vector<T> v;T x;

	rp(i,0,s)v.push_back(init);

	rp(i,s,e){x=in<T>();v.push_back(x);}

	return v;

}



int N;

vi P;



int solve(){

	int ans=0;

	int minP = INT_MAX;

	rp(i,0,N){

		if(minP >= P[i]){

			minP = P[i];

			ans++;

		}

	}

	return ans;

}



int main(){

	cin>>N;

	P = inarr<int>(0,N,0);

	cout<< solve() <<endl;

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

using namespace std;

#define rep(i,r) for (int i = 0; i < r; i++)

#define isc(n) scanf("%d", &n)



int main() {

  int N;

  scanf("%d", &N);

  int count = 0;

  for (int i = 0, m = N, P; i < N; i++) {

    scanf("%d", &P);

    if (P <= m) {

      m = P;

      count++;

    }

  }

  printf("%d", count);

  return 0;

}


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



int main() {

  int N;

  scanf("%d", &N);

  int count = 0;

  for (int i = 0, m = N, P; i < N; i++) {

    scanf("%d", &P);

    if (P <= m) {

      m = P;

      count++;

    }

  }

  printf("%d", count);

  return 0;

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



using namespace std;



int main(){

  int N;

  cin >> N;

  vector<int> P(N);

  vector<int> minP(N);

  cin >> P[0];

  minP[0] = P[0];

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

    cin >> P[i];

    minP[i] = min(P[i], minP[i - 1]);

  }

  

  int cnt = 0;

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

    if(minP[i] >= P[i]) cnt++;

  }

  

  cout << cnt << endl;

  

  return 0;

}

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



int main(){

  int N;

  scanf("%d", &N);

  int in;

  int m_in = 200000;

  int cn = 0;

  for(;N-->0;){

    scanf("%d", &in);

    if(m_in >= in){

      cn++;

      m_in = in;

    }

  }

  

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

  

  return 0;

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



using namespace std;



int main(){

  int N;

  cin >> N;

  vector<int> P(N);

  vector<int> minP(N);

  cin >> P[0];

  minP[0] = P[0];

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

    cin >> P[i];

    minP[i] = min(P[i], minP[i - 1]);

  }

  

  int cnt = 0;

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

    if(minP[i] >= P[i]) cnt++;

  }

  

  cout << cnt << endl;

  

  return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.242610583953874x):
#pragma GCC optimize("Ofast")



#include<cstdio>



int main(){

  int N;

  scanf("%d", &N);

  int in;

  int m_in = 200000;

  int cn = 0;

  for(;N-->0;){

    scanf("%d", &in);

    if(m_in >= in){

      cn++;

      m_in = in;

    }

  }

  

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

  

  return 0;

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

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

using namespace std;

typedef long long ll;



ll n, ans=1, dp;

vector<ll> p(201001);



int main(){

  

  cin >> n;

  rep(i,n) cin >> p.at(i);

  

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

    

    if (i == 1) dp = p.at(0);

    else dp = min (p.at(i-1), dp);

    

      if(dp > p.at(i)) ans++;

    }

  

  cout << ans << endl;

  

  }

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

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

using namespace std;

typedef long long ll;

const int inf = 1001001001;



int main(){

    int n;

    cin >> n;

    

    vector<int> p(n);

    rep(i,n) cin >> p.at(i);

    

    int mn = 0, ans = 0;

    

    rep(i,n) {

        if(i == 0 || p.at(i) < mn) {

            ans++;

            mn = p.at(i);

        }

    }

    cout << ans << endl;

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

using namespace std;

int p[200010];

int main(void)

{

    int n,sum=0,mi=1e9;

    cin >> n;

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

        cin >> p[i];

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

    {

        if(p[i]<mi)

        {

            mi=p[i];

            sum++;

        }

    }

    cout << sum;

    return 0;

}

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

int main(void)

{

    int n,sum=0,mi=1e9,p;

    scanf("%d" ,&n);

    while(n--){

        scanf("%d" ,&p);

        if(p<mi)

        {

            mi=p;

            sum++;

        }

    }

    printf("%d" ,sum);

    return 0;

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

#include <cmath>



#include <algorithm>

#include <iostream>

#include <vector>

#include <list>

#include <tuple>

#include <string>



using namespace std;



#define MAX(A, B)	((A) > (B) ? (A) : (B))

#define MIN(A, B)	((A) < (B) ? (A) : (B))





int main(int argc, char const *argv[]) {

	string s;

	cin >> s;



	char c = s[0];

	int r = 0;



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

		if (c != s[i]) {

			c = s[i];

			r += 1;

		}

	}



	cout << r << endl;



	return 0;

}

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

#include<cstring>

char str[100050];

int main()

{

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

	{

		int ans = 0;

		char ch;

		int n = strlen(str);

		ch = str[0];

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

		{

			if(str[i] != ch)

			{

				ans++;

				ch = str[i];

			}

		} 

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

	}

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

#include <iostream>

#include <string>

#include <unordered_set>

#include <vector>

using std::cin;

using std::cout;

using std::endl;

using std::ios;

using std::string;



int main() {

  ios::sync_with_stdio(false);

  cin.tie(0);

  string str;

  int count = 0;

  cin >> str;

  char t = str[0];

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

    if (str[i] != t) {

      count++;

      t = str[i];

    }

  }

  cout << count << endl;

  return 0;

}


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

#include<cstring>

char str[100050];

int main()

{

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

	{

		int ans = 0;

		char ch;

		int n = strlen(str);

		ch = str[0];

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

		{

			if(str[i] != ch)

			{

				ans++;

				ch = str[i];

			}

		} 

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

	}

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

#include<cmath>

#include<algorithm>

#include<cstdio>

#include<stack>

#include<queue>

#include<map>



using namespace std;



int main(){

	string s;

	cin>>s;

	int ans=0;

	char c=s[0];

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

		if(c!=s[i]){

			ans++;

			c=s[i];

		} 

	}

	cout<<ans<<endl;

	return 0;

}

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

#include<cstring>

char str[100050];

int main()

{

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

	{

		int ans = 0;

		char ch;

		int n = strlen(str);

		ch = str[0];

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

		{

			if(str[i] != ch)

			{

				ans++;

				ch = str[i];

			}

		} 

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

	}

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

#include<cstring>

#include<iostream>

#include<algorithm>

using namespace std;



int main ()

{

	char S[100000+521];

	memset(S,0,sizeof(S));

	cin >> S;

	int ans=0;

	for(int i = 0;S[i+1]!=0;i++)

	{

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

			ans++;

	}

	cout << ans;

	return 0;

}

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

using namespace std;

char s[100005];

int main()

{

	scanf("%s",s);

	int l=strlen(s);

	int sum=0;

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

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

			sum++;

	printf("%d\n",sum-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.223380868592169x):
#include<cstdio>



using namespace std;



char s[100001];

int main(){

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

	int n=0,m=0;for(;s[n+1];n++);

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

	printf("%d",m-1);

}
// 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.223022648288595x):
#include<cstdio>



using namespace std;



char s[100001];

int main(){

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

	int n=0,m=0;for(;s[n+1];n++);

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

	printf("%d",m-1);

}
// 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.211510844915645x):
#include <cstdio>

#include <algorithm>

#include <cstring>



typedef long long ll;



char s[100005]; int n;



int main() {

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

	

	int ans = 0;

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

	

	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.211153438660211x):
#include <cstdio>

#include <algorithm>

#include <cstring>



typedef long long ll;



char s[100005]; int n;



int main() {

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

	

	int ans = 0;

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

	

	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.2095891606417135x):
#include <cstdio>

#include <algorithm>

#include <cstring>



typedef long long ll;



char s[100005]; int n;



int main() {

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

	

	int ans = 0;

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

	

	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.210705632426441x):
#include <cstdio>

#include <cstdlib>

#include <algorithm>

#include <cstring>



const int maxn = 1e5 + 20;



int n;

char s[maxn];



int main()

{

	int ans = 0;

	

	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);

	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.210348281392609x):
#include <cstdio>

#include <cstdlib>

#include <algorithm>

#include <cstring>



const int maxn = 1e5 + 20;



int n;

char s[maxn];



int main()

{

	int ans = 0;

	

	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);

	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.20878424506529x):
#include <cstdio>

#include <cstdlib>

#include <algorithm>

#include <cstring>



const int maxn = 1e5 + 20;



int n;

char s[maxn];



int main()

{

	int ans = 0;

	

	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);

	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.210705632426441x):
#include <cstdio>

#include <cstdlib>

#include <algorithm>

#include <cstring>



const int maxn = 1e5 + 20;



int n;

char s[maxn];



int main()

{

	int ans = 0;

	

	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);

	return 0;

}