Go: package main

import (
	"fmt"
	"strings"
)

func main() {
	var n int
	var s string
	_, _ = fmt.Scan(&n)
	_, _ = fmt.Scan(&s)
	fmt.Println(calc(s))
}

func calc(s string) int {
	sum := 0
	ss := strings.Split(s,"")
	bf := 0
	for _, v := range ss{
		if bf == 0 {
			bf = cnv(v)
		} else if bf != cnv(v) {
			sum++
			bf = 0
		}
	}
	return sum
}

func cnv(s string) int {
	switch s {
	case "O":
		return 1
	case "X":
		return 2
	}
	return 0
}

C++: #include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define INF INT_MAX
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
#define sec second
#define fir first
typedef long long ll;
typedef pair<int, int> P;
typedef priority_queue<int> pque;
typedef vector<int> Vec;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;};



signed main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);

    int n;
    string s;
    cin >> n >> s;
    int ans = 0;
    REP(i, 1, n) {
        if(s[i-1] != s[i]) {
            ans++;
            i++;
        }
    }
    cout << ans << endl;
    return 0;
}

C++: #include <iostream>
using namespace std;

int main(void){

    int n;
    string s;
    cin >> n;
    cin >> s;
    bool precircle;
    bool ck=true;
    if(s[0]=='O') precircle=true;
    if(s[0]=='X') precircle=false;
    int c = 0;
    for(int i=1;i<n;i++){
        if((s[i]=='O' and precircle==false and ck) or (s[i]=='X' and precircle==true and ck)){
          c++;
          ck = false;
        } else{
            ck = true;
        }
        if(s[i]=='O') precircle=true;
        if(s[i]=='X') precircle=false;
    }
    cout << c << endl;
}

C++: #include <iostream>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;

#define MOD 1000000007
#define INF 1e9+7
#define rep(i, n) for(int i=0; i<n; ++i)
#define rrep(i, m, n) for(int i=m; i<n; ++i)
typedef long long ll;

#define MAX_N 100000
#define MAX_M 100000
#define MAX_V 100
#define MAX_E 100

int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};

int ddx[] = {-1, 0, 1, 0, -1, 1, -1, 1};
int ddy[] = {0, -1, 0, 1, 1, 1, -1, -1};

//--------------------------

int func(vector<char> &v, int len) {

  int cnt = 0;

  for(int i=0; i<len-1; ++i) {
    if(v[i]!=v[i+1]) {
      ++cnt;
      ++i;
    }
  }

  return cnt;
}

int main() {

  int n;
  vector<char> vc(100001);

  cin >> n;
  rep(i, n) cin >> vc[i];

  int cnt1, cnt2 = 0;

  cnt1 = func(vc, n);

  reverse(vc.begin(), vc.begin()+n);

  cnt2 = func(vc, n);

  cout << max(cnt1, cnt2) << endl;

  return 0;
}

C++: #include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define MMP(a, b, c) make_pair(make_pair(a, b), c)
#define MAX 1000000000
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
#define PI 3.14159265359

int main(){
    iostream::sync_with_stdio(false);
    
	int N;
	cin >> N;
	string S;
	cin >> S;
	int ans = 0;
	for(int i=0; i<N-1; i++){
		if(S[i] != S[i+1]){
			ans++;
			i++;
		}
	}
	cout << ans << endl;
    
    return 0;
}

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

using namespace std;

bool exist[2021];

int main() {
    int n;
    cin >> n;
    string  s;
    cin >> s;
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        if (s[i] == 'O' && s[i + 1] == 'X') {
            ++ans;
            ++i;
        } else if (s[i] == 'X' && s[i + 1] == 'O') {
            ++ans;
            ++i;
        }
    }
    cout << ans << '\n';
}

C++: #include<bits/stdc++.h>
using namespace std; 
int main(void){
	int	n;
	char a[100001];
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	int i=0;
	int cnt=0;
	while(1){
		if(i>=n-1)	break;
		//cout<<i<<endl;
		if(a[i]!=a[i+1]){
			cnt++;
			i+=2;
		}
		else{
			i++;
		}
	}
	cout<<cnt<<endl;
	return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<utility>
#include<deque>
#include<iomanip>
#include<ctime>
using namespace std;


int main()
{
	string str;//スタンプ文字列
	int N;//スタンプ数
	cin >> N;
	cin >> str;

	int count = 0;

	for (int i = 0; i < N; i++) {
		if (i < N - 1 && str[i] != str[i + 1]) {
			count++;
			i++;
		}
	}

	cout << count << endl;

	return 0;
}

C++: #include<iostream>
#include<vector>
using namespace std;

int main(){
    int n;
    string s;
    cin >> n >> s;
    if(n == 1){
        cout << 0 << endl;
        return 0;
    }
    vector<int> dp(n, 0);
    dp[1] = (s[0] != s[1]);
    for(int i = 2; i < n; i++)  dp[i] = max(dp[i-1], (s[i]!=s[i-1])*(dp[i-2]+1));
    cout << dp[n-1] << endl;
    return 0;
}

C++: #include <bits/stdc++.h>
typedef long long LL;
using namespace std;

int main(){
  int n;
  string s;
  cin >> n >> s;

  int ans = 0;
  for (int i = 1; i < n; i ++) {
    if ((s[i] == 'O' && s[i-1] == 'X') || (s[i] == 'X' && s[i-1] == 'O')) {
      ans ++;
      i ++;
    }
  }

  cout << ans << endl;
}