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

#include<cstdio>

#include<algorithm>

using namespace std;

int main()

{

	int n,m=0;

	char a[100009];

	cin>>n;

	cin>>a;

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

	{

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

		{

			m++;

		}

	}

	cout<<m<<endl;

	return 0;

 } 

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

#include <string.h>

int main ()

{

	long long int N,i,j,l;

	char S[1000000],a[1000000];

	scanf("%lld %s",&N,S);

	a[0]=S[0];

	for(i=1,j=1;S[j]!='\0';j++)

	{

		

		if(a[i-1]==S[j])

		{

			continue;

		}

		else

		{

			a[i]=S[j];

			i++;

		}

		

	}

	l=strlen(a);

	printf("%lld",l);

	

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

	{

		a[i]='\0';

	}

	return 0;

	

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

using namespace std;



int main()

{

    long int n;

    int i,sum=0,temp;

    string s;

    cin >> n;

    cin >> s;

    temp=s[0];

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

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

            continue;

        else

        {

            temp=s[i+1];

            sum++;

        }





    }

    cout <<sum;



    return 0;

}

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

#include <string.h>

int main ()

{

	long long int N,i,j,l;

	char S[1000000],a[1000000];

	scanf("%lld %s",&N,S);

	a[0]=S[0];

	for(i=1,j=1;S[j]!='\0';j++)

	{

		

		if(a[i-1]==S[j])

		{

			continue;

		}

		else

		{

			a[i]=S[j];

			i++;

		}

		

	}

	l=strlen(a);

	printf("%lld",l);

	

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

	{

		a[i]='\0';

	}

	return 0;

	

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

using namespace std;

string s;

char a;

int n,cnt;

int main(){

	cin>>n>>s;

	a=s[0];

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

		if(s[i]!=a){

			cnt++;

			a=s[i];

		}

	}

	cout<<cnt+1<<endl;

	return 0;

}

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

#include <string.h>

int main ()

{

	long long int N,i,j,l;

	char S[1000000],a[1000000];

	scanf("%lld %s",&N,S);

	a[0]=S[0];

	for(i=1,j=1;S[j]!='\0';j++)

	{

		

		if(a[i-1]==S[j])

		{

			continue;

		}

		else

		{

			a[i]=S[j];

			i++;

		}

		

	}

	l=strlen(a);

	printf("%lld",l);

	

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

	{

		a[i]='\0';

	}

	return 0;

	

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

using namespace std;

int main()

{

   int i,j,n,sz,cnt=1;

   string s;

   cin>>n>>s;

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

   {

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



      cnt++;

   }

   cout<<cnt<<endl;



   return 0;

}

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

#include <string.h>

int main ()

{

	long long int N,i,j,l;

	char S[1000000],a[1000000];

	scanf("%lld %s",&N,S);

	a[0]=S[0];

	for(i=1,j=1;S[j]!='\0';j++)

	{

		

		if(a[i-1]==S[j])

		{

			continue;

		}

		else

		{

			a[i]=S[j];

			i++;

		}

		

	}

	l=strlen(a);

	printf("%lld",l);

	

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

	{

		a[i]='\0';

	}

	return 0;

	

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

using namespace std;



int main(){

    int n;

    int out=1;

    string s;

    cin>>n>>s;

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

    {

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

    }

    cout<<out<<endl;

	return 0;

}


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

#include <string.h>

int main ()

{

	long long int N,i,j,l;

	char S[1000000],a[1000000];

	scanf("%lld %s",&N,S);

	a[0]=S[0];

	for(i=1,j=1;S[j]!='\0';j++)

	{

		

		if(a[i-1]==S[j])

		{

			continue;

		}

		else

		{

			a[i]=S[j];

			i++;

		}

		

	}

	l=strlen(a);

	printf("%lld",l);

	

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

	{

		a[i]='\0';

	}

	return 0;

	

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





#define ll long long



using namespace std;





int main()

{

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



    int n;

    cin >> n;



    string s;

    cin >> s;



    int res = 1;

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

    {

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

    }



    cout << res << endl;



    return 0;

}


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

#include <string.h>

int main ()

{

	long long int N,i,j,l;

	char S[1000000],a[1000000];

	scanf("%lld %s",&N,S);

	a[0]=S[0];

	for(i=1,j=1;S[j]!='\0';j++)

	{

		

		if(a[i-1]==S[j])

		{

			continue;

		}

		else

		{

			a[i]=S[j];

			i++;

		}

		

	}

	l=strlen(a);

	printf("%lld",l);

	

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

	{

		a[i]='\0';

	}

	return 0;

	

}
// Slower C++ solution:
// Example program

#include <iostream>

#include <string>

using namespace std;

int main()

{

    int number,counter=0;

    string name;

    cin >>number>> name;

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

    {

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

        {

            counter++;

        }

    }

    cout  << counter+1<<"\n";

}


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

#include <string.h>

int main ()

{

	long long int N,i,j,l;

	char S[1000000],a[1000000];

	scanf("%lld %s",&N,S);

	a[0]=S[0];

	for(i=1,j=1;S[j]!='\0';j++)

	{

		

		if(a[i-1]==S[j])

		{

			continue;

		}

		else

		{

			a[i]=S[j];

			i++;

		}

		

	}

	l=strlen(a);

	printf("%lld",l);

	

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

	{

		a[i]='\0';

	}

	return 0;

	

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

#include <bits/stdc++.h>

using namespace std;



#define pb push_back

#define F first

#define S second

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



using ll = long long;

using ld = long double;

using ul = unsigned long long;

using ii = pair<int, int>;

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

#define ReadFile            freopen("input.in","r",stdin)

#define WriteFile           freopen("output.txt","w",stdout)

const ll mod7 = 1000000007,mod = 1000000000,OO = 0x3f3f3f3f;

const ld EPS = 1e-7;

double Pi=acos(-1);

const ld rad=Pi/180.0;

ll power(ll x, ll y, ll p)

{

    ll res = 1;

    while (y > 0)

    {

        if (y & 1)

            res = (res*x) % p;

        y = y>>1;

        x = (x*x) % p;

    }

    return res;

}

ll nCr (ll n,ll m)

{

    return(m == 0)?1:n*nCr(n-1,m-1)/m;

}

/*****************************************************/



int main()

{

    ll n , x = 1;

    char a[100005];

    cin >> n;



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

        cin >> a[i];



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

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

            x++;



    cout << x << "\n";



	return 0;

}


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

#include <string.h>

int main ()

{

	long long int N,i,j,l;

	char S[1000000],a[1000000];

	scanf("%lld %s",&N,S);

	a[0]=S[0];

	for(i=1,j=1;S[j]!='\0';j++)

	{

		

		if(a[i-1]==S[j])

		{

			continue;

		}

		else

		{

			a[i]=S[j];

			i++;

		}

		

	}

	l=strlen(a);

	printf("%lld",l);

	

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

	{

		a[i]='\0';

	}

	return 0;

	

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

#include "sstream"

#define quick ios_base::sync_with_stdio(false);cin.tie(NULL);

using namespace std;

const int N=1e5+1;

set<char>st;

int main() {

    quick

int n; string s,ans; cin>>n>>s;  ans=s[0];

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

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

        ans.push_back(s[i]); }

}

cout<<ans.size();

}

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

#include <string.h>

int main ()

{

	long long int N,i,j,l;

	char S[1000000],a[1000000];

	scanf("%lld %s",&N,S);

	a[0]=S[0];

	for(i=1,j=1;S[j]!='\0';j++)

	{

		

		if(a[i-1]==S[j])

		{

			continue;

		}

		else

		{

			a[i]=S[j];

			i++;

		}

		

	}

	l=strlen(a);

	printf("%lld",l);

	

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

	{

		a[i]='\0';

	}

	return 0;

	

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

using namespace std;

int main()

{



    int num;

    string word;

    cin>>num;cin>>word;

    for(int i=1;i<word.length();)

    {

        if(word[i]==word[i-1])

            word.erase(word.begin()+i-1,word.begin()+i);

        else

            i++;

    }

    cout<<word.length()<<endl;

    return 0;

}




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

#include <string.h>

int main ()

{

	long long int N,i,j,l;

	char S[1000000],a[1000000];

	scanf("%lld %s",&N,S);

	a[0]=S[0];

	for(i=1,j=1;S[j]!='\0';j++)

	{

		

		if(a[i-1]==S[j])

		{

			continue;

		}

		else

		{

			a[i]=S[j];

			i++;

		}

		

	}

	l=strlen(a);

	printf("%lld",l);

	

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

	{

		a[i]='\0';

	}

	return 0;

	

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

#include <algorithm>

using namespace std;



int main()

{

    int n;

    string s;

    cin >> n;

    cin >> s;

    char c = s[0];

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

    {

        if(c == s[i])

        {

            s[i] = '*';

        }else

        {

            c = s[i];

        }

    }

    s.erase(remove(s.begin(), s.end(), '*'), s.end());

    cout << s.size() << endl;

    return 0;

}


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

#include <string.h>

int main ()

{

	long long int N,i,j,l;

	char S[1000000],a[1000000];

	scanf("%lld %s",&N,S);

	a[0]=S[0];

	for(i=1,j=1;S[j]!='\0';j++)

	{

		

		if(a[i-1]==S[j])

		{

			continue;

		}

		else

		{

			a[i]=S[j];

			i++;

		}

		

	}

	l=strlen(a);

	printf("%lld",l);

	

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

	{

		a[i]='\0';

	}

	return 0;

	

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

using namespace std;

int main(){

        int n,c=1;



   string s;

   cin>>n;

    cin>>s;

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

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

            continue;

        else c++;

  }

  cout<<c<<endl;

  }

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

#include <string.h>

int main ()

{

	long long int N,i,j,l;

	char S[1000000],a[1000000];

	scanf("%lld %s",&N,S);

	a[0]=S[0];

	for(i=1,j=1;S[j]!='\0';j++)

	{

		

		if(a[i-1]==S[j])

		{

			continue;

		}

		else

		{

			a[i]=S[j];

			i++;

		}

		

	}

	l=strlen(a);

	printf("%lld",l);

	

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

	{

		a[i]='\0';

	}

	return 0;

	

}
// Slower C++ solution:
/* ANTHOR KUMAR DAS

KUET ECE 2K18*/

#include<bits/stdc++.h>

using namespace std;

#define ll long long

#define sc(a) scanf("%d",&a)

#define sc1(n) scanf("%lld",&n)

#define sc2(b,c) scanf("%lld%lld",&b,&c)

#define f(a,b) for(a=0;a<b;a++)

#define pb(a) push_back(a)

#define br break

int main()

{

    int n,i,j,c=1;

    cin>>n;

    char s[n];

    f(i,n)

    {

        cin>>s[i];

    }

    f(i,(n-1))

    {

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

        {

            c++;

        }

    }

    cout<<c<<endl;





    return 0;

}




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

#include <string.h>

int main ()

{

	long long int N,i,j,l;

	char S[1000000],a[1000000];

	scanf("%lld %s",&N,S);

	a[0]=S[0];

	for(i=1,j=1;S[j]!='\0';j++)

	{

		

		if(a[i-1]==S[j])

		{

			continue;

		}

		else

		{

			a[i]=S[j];

			i++;

		}

		

	}

	l=strlen(a);

	printf("%lld",l);

	

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

	{

		a[i]='\0';

	}

	return 0;

	

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

#include<map>

#include<string>

#include<string.h>

#include<utility>

#include<algorithm>

#include<vector>

#include<queue>

#include<iostream>

#include<math.h>

#include<stack>

#include<set>

#define INF 2147483647

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

#define mem(arr) memset(arr, 0, sizeof(arr));

using namespace std;

typedef long long lli;

typedef double llf;

typedef pair<int, int> P;

typedef vector<int> vec;

typedef priority_queue<int, vector<int>, greater<int> > pQ;

typedef queue<int> Q;

typedef set<int> S;

struct edge{

	int to, value;

};

void solve();

int main()

{

	int times = 1;

//	cin >> times;

	loop(i, 1, times)

	{

		solve();

		cout << '\n';

	}

	return 0;

}

const int n = 2e5;

vector<edge> tree[n + 50];

int a, b, c, d, e, f;

int arr[n + 50], arr1[n + 50], arr2[n + 50];

string str, str1, str2;



void solve()

{

	cin >> a;

	cin >> str;

	stack<char> S;

	S.push(str[0]);

	int cnt = 1;

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

	{

		if(str[i] == S.top()) continue;

		else

		{

			cnt ++;

			S.push(str[i]);

		}

	}

	cout << cnt << '\n';

}

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

using namespace std;



int main() {

  int n;

  string s;

  cin >> n >> s;

  s.resize(unique(s.begin(), s.end()) - s.begin());

  cout << s.size() << "\n";

  return 0;

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

using namespace std;

int n;

char a[100001];

int main(){

    int d=1;

    int res=1;

    cin>>n;

    for (int i=1;i<=n;i++) {cin>>a[i];

    if (a[i]!=a[d]) {res++;d=i;}

    }

    cout<<res;

}

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

int main()

{

	int a,n,cnt=1;

	char s[100000];

	scanf("%d",&n);

	getchar();

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

		scanf("%c",&s[a]);

	}

	for(a=0;a<n-1;a++){

		if(s[a]!=s[a+1]){

			cnt++;

		}

	}

	printf("%d",cnt);

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

using namespace std;



typedef long long ll;



const int N = 50;

ll arr[N + 5];



int main() {

	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);

	int n;

	cin>>n;

	string s;

	cin>>s;

	char c = '@';

	int tot = 0;

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

		if(c != s[i]) tot++;

		c = s[i];

	}

	cout<<tot<<endl;

}

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

int main()

{

	int a,n,cnt=1;

	char s[100000];

	scanf("%d",&n);

	getchar();

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

		scanf("%c",&s[a]);

	}

	for(a=0;a<n-1;a++){

		if(s[a]!=s[a+1]){

			cnt++;

		}

	}

	printf("%d",cnt);

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

#include <cstdio>

#include <cstring>

using namespace std;

int main() {

    int cnt = 0, n;

    char temp, old = '#';

    scanf("%d", &n);

    getchar();

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

        scanf("%c", &temp);

        if (temp != old) cnt++;

        old = temp;

    }

    printf("%d", cnt);

//return

    return 0;

}

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

int main()

{

	int a,n,cnt=1;

	char s[100000];

	scanf("%d",&n);

	getchar();

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

		scanf("%c",&s[a]);

	}

	for(a=0;a<n-1;a++){

		if(s[a]!=s[a+1]){

			cnt++;

		}

	}

	printf("%d",cnt);

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

using namespace std;



int main()

{

    int n;

    char s[100001]={};

    cin>>n;

    int tag = 0;

    int ans = 0;

    cin>>s;

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

    {

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

        {

            continue;

        }

        ans++;

    }

    cout <<ans;

    return 0;

}






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

int main()

{

	int a,n,cnt=1;

	char s[100000];

	scanf("%d",&n);

	getchar();

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

		scanf("%c",&s[a]);

	}

	for(a=0;a<n-1;a++){

		if(s[a]!=s[a+1]){

			cnt++;

		}

	}

	printf("%d",cnt);

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

using namespace std; 

int main(){

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

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

	int n,o=0;

	cin>>n;

	char slimes[n+1],a[n+1];

	memset(a,0,sizeof(a));

	cin>>slimes;

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

			if(slimes[i]==a[o]) continue;

			if(slimes[i]==slimes[i+1]){

				a[o]=a[i];

			}

			else o++;

	}

	cout<<o+1;

    return 0;

}

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

int main()

{

	int a,n,cnt=1;

	char s[100000];

	scanf("%d",&n);

	getchar();

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

		scanf("%c",&s[a]);

	}

	for(a=0;a<n-1;a++){

		if(s[a]!=s[a+1]){

			cnt++;

		}

	}

	printf("%d",cnt);

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

#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

#define maxn 100010

char ss[maxn];

int main()

{

	int n;

	cin>>n;

	cin>>ss;

	int siz=sizeof(ss);

	char pre;

	pre=ss[0];

	int cnt=0;

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

	{

		if(pre!=ss[i])

		{

			cnt++;

			pre=ss[i];

		 } 

	}

	cout<<cnt;

	return 0;

 } 

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

int main()

{

	int a,n,cnt=1;

	char s[100000];

	scanf("%d",&n);

	getchar();

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

		scanf("%c",&s[a]);

	}

	for(a=0;a<n-1;a++){

		if(s[a]!=s[a+1]){

			cnt++;

		}

	}

	printf("%d",cnt);

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

using namespace std;



int main()

{

    int n;

    char s[100001]={};

    cin>>n;

    int tag = 0;

    int ans = 0;

    cin>>s;

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

    {

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

        {

            continue;

        }

        ans++;

    }

    cout <<ans;

    return 0;

}






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

#include <bits/stdc++.h>

#define ll long long

#define oo (int)1e9

#define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);

using namespace std;

const int N = 1e5 + 5, M = 2 * N + 5;



char s[N];

int main(){

    int n;

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

    int cnt = 0;

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

        int j = i;

        while(j < n && s[i] == s[j])++j;

        ++cnt;

        i = j;

    }

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

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

#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

#define maxn 100010

char ss[maxn];

int main()

{

	int n;

	cin>>n;

	cin>>ss;

	int siz=sizeof(ss);

	char pre;

	pre=ss[0];

	int cnt=0;

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

	{

		if(pre!=ss[i])

		{

			cnt++;

			pre=ss[i];

		 } 

	}

	cout<<cnt;

	return 0;

 } 

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

#include <bits/stdc++.h>

#define ll long long

#define oo (int)1e9

#define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);

using namespace std;

const int N = 1e5 + 5, M = 2 * N + 5;



char s[N];

int main(){

    int n;

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

    int cnt = 0;

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

        int j = i;

        while(j < n && s[i] == s[j])++j;

        ++cnt;

        i = j;

    }

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

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

#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

#define maxn 100010

char ss[maxn];

int main()

{

	int n;

	cin>>n;

	cin>>ss;

	int siz=sizeof(ss);

	char pre;

	pre=ss[0];

	int cnt=0;

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

	{

		if(pre!=ss[i])

		{

			cnt++;

			pre=ss[i];

		 } 

	}

	cout<<cnt;

	return 0;

 } 

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



using namespace std;



int main()

{

   int n;

   cin>>n;

   string a ;

   cin>>a;

   int v[27]={0};

   int C=n;

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

   {

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

        C--;

   }

   cout<<C<<endl;

    return 0;

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

#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

#define maxn 100010

char ss[maxn];

int main()

{

	int n;

	cin>>n;

	cin>>ss;

	int siz=sizeof(ss);

	char pre;

	pre=ss[0];

	int cnt=0;

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

	{

		if(pre!=ss[i])

		{

			cnt++;

			pre=ss[i];

		 } 

	}

	cout<<cnt;

	return 0;

 } 

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

using namespace std;

#define ll	    long long

#define vi      vector <int>

#define vii     vector <pair<int,int>>

#define ii      pair<int,int>

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

ll mod=1e9+7;

bool is_prime(int n)

{

    if(n==2)

        return true;

    if(n%2==0||n<2)

        return false;

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

    {

        if(n%i==0)

            return false;

    }

    return true;

}

long long power(ll n, ll k){

    if(k==0) return 1;

    ll sq=(power(n,k/2))%mod;

    sq=(sq*sq)%mod;

    if(k%2==1)

        sq=(sq*n)%mod;

    return sq%mod;

}

void low(char &c){

c=tolower(c);

}

void primeFactors(int n)

{

    while (n % 2 == 0)

    {

        cout << 2 << " ";

        n = n/2;

    }



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

    {

        while (n % i == 0)

        {

            cout << i << " ";

            n = n/i;

        }

    }



    if (n > 2)

        cout << n << " ";

}



#include <iostream>

using namespace std;

void fast();

long long arr[200005];

long long arr2[200005];





int main() {

fast();

int n;

string s;

cin >> n >> s;

int sum=1;

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

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

        sum++;

    }

}



cout << sum;

}











void fast(){

std::ios_base::sync_with_stdio(0);

    cin.tie(NULL);

    cout.tie(NULL);



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

#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

#define maxn 100010

char ss[maxn];

int main()

{

	int n;

	cin>>n;

	cin>>ss;

	int siz=sizeof(ss);

	char pre;

	pre=ss[0];

	int cnt=0;

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

	{

		if(pre!=ss[i])

		{

			cnt++;

			pre=ss[i];

		 } 

	}

	cout<<cnt;

	return 0;

 } 

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

#include            <bits/stdc++.h>

#include            <ext/pb_ds/assoc_container.hpp>

#include            <ext/pb_ds/tree_policy.hpp>

#define FastIO      ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)

#define pb          push_back

#define mp          make_pair

#define mem(x,i)    memset(x,i,sizeof(x))

#define ff          first

#define ss          second

#define popcount(x) __builtin_popcount(x)

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

#define Case(t)     for(int ks=1;ks<=t;ks++)

#define fileout     freopen("output.txt","w",stdout)

#define filein      freopen("input.txt","r",stdin)

#define D(x)        cerr<< __LINE__ <<": "<< #x << " = "<<(x) <<'\n';

#define endl        '\n'



using namespace std;

using namespace __gnu_pbds;



using ll  = long long;

using ld  = long double;

using ull = unsigned long long;

using pii = pair<int,int>;

using pll = pair<ll,ll>;

using pil = pair<int,ll>;



const int INF    = 0x3f3f3f3f;

const ll LL_INF  = 0x3f3f3f3f3f3f3f3f;

const double PI  = acos(-1);

const double eps = 1e-4;

const int mod    = 1e9+7;

const int mx     = 5e5+5;

template <typename T>  using orderedSet =

    tree<T, null_type, less_equal<T>,

    rb_tree_tag, tree_order_statistics_node_update>;//find_by_order,order_of_key*/



/*------------------------------Graph Moves----------------------------*/

//const int fx[]= {+1,-1,+0,+0};

//const int fy[]= {+0,+0,+1,-1};

//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move

//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move

//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move

//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move

/*---------------------------------------------------------------------*/



//ll powmod(ll a,ll b){ll res=1;a%=mod;assert(b>=0);for(; b; b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

/*----------------------BitMask-----------------------------------------*/

//inline int setBit(int N,int pos){return N=N | (1<<pos);}

//inline int resetBit(int N,int pos){return N= N & ~(1<<pos);}

//inline bool checkBit(int N,int pos){return (bool) (N& (1<<pos));}



int main()

{

    int n;

    cin>>n;

    vector<char>v;

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

    {

        char c;cin>>c;

        if(v.empty() || v.back()!=c) v.pb(c);

    }

    cout<<v.size()<<endl;

}