Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextInt() (int, error) {
	s, _ := nextString()
	return strconv.Atoi(s)
}

func nextString() (string, bool) {
	succeeded := scanner.Scan()
	if succeeded {
		return scanner.Text(), succeeded
	}
	return "", succeeded
}

func printArr(arr []string) {
	fmt.Println(strings.TrimRight(fmt.Sprintf("%+v", arr)[1:], "]"))
}

func main() {
	scanner.Split(bufio.ScanWords)

	const maxCapacity = 512 * 1024
	buf := make([]byte, maxCapacity)
	scanner.Buffer(buf, maxCapacity)

	n, _ := nextInt()
	if n == 1 {
		fmt.Println(0)
		return
	}

	s, succeeded := nextString()
	if !succeeded {
		fmt.Errorf("Scan failed")
		return
	}
	nOX := 0
	i := 1
	for {
		if s[i] != s[i-1] {
			nOX++
			i++
		}
		i++
		if i >= n {
			break
		}
	}
	fmt.Println(nOX)
}

C++: 
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <stack>
using namespace std;

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

  int flag1 = 0;
  int flag2 = 0;
  int flag = 0;
  int count = 0;

  for(int i = 0; i < n-1;) {
    if(s[i] != s[i+1]){
      count++;
      i+=2;
      flag = 1;
    }
    else {
      i++;
      flag = 0;
    }
  }


  cout << count << endl;
  /*
  for(int i = 0; i < n; i++) {
    if(s[i] == 'O' && flag1 == 0 && flag != 1) {
      flag1 = 1;
      flag = 1;
      cout << "1: " ;
    }
    else if(s[i] == 'X' && flag2 == 0 && flag != 1) {
      flag2 = 1;
      flag = 1;
      cout << "2: " ;
    }
    else if(s[i] == 'O' && flag2 == 1) {
      count++;
      flag2 = 0;
      flag1 = 0;
      flag = 0;
      cout << "3: " ;
    }
    else if(s[i] == 'X' && flag1 == 1) {
      count++;
      flag1 = 0;
      flag2 = 0;
      flag = 0;
      cout << "4: " ;
    }
    else {

      flag1 = 0;
      flag2 = 0;
      flag = 0;

      cout << "5: " ;

    }
  //  if(i % 2 == 0) cout << count << endl;


    cout <<"i:"<< i << " " << s[i] << " " << flag1 << " " << flag2 <<" " << count << endl;

  }

  if(flag1 == 1 && flag2 == 1) {
    count++;
  }
  */

}

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef long long int ll;

template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}


#define ARRAY_MAX 100005
const int INF = 1e9 + 7;

int dp[ARRAY_MAX];

int main() {

	int n;
	cin >> n;
	string s;
	cin >> s;

	int maxi = 0;

	for (int i = 0; i < n - 1; i++)
	{
		if (s[i] != s[i + 1])
		{
			dp[i + 2] = max(dp[i + 2], max(maxi, dp[i] + 1));
			maxi = max(dp[i + 2], maxi);
		}
		else
		{
			dp[i + 2] = max(dp[i + 2], max(maxi, dp[i]));
			maxi = max(dp[i + 2], maxi);
		}
	}

	cout << dp[n] << endl;
}

C++: /*
17D8101013F 森田　匡博
JOI0654.cpp 2019/10/31
ID:key4 使用言語:C++
*/

#include <iostream>
#include <cmath>
#include <string>

int main()
{
  int mb = 0; //マルバツ
  long long int N;
  std::cin >> N;

  std::string str;
  std::cin >> str;

  //std::cout << str[1];

  for(int i = 0; i < N; i++) {
    if(i != N - 1) {
      char s1 = str[i];
      char s2 = str[i+1];
      if((s1 == 'O' && s2 == 'X') || (s1 == 'X' && s2 == 'O')) {
	mb++;
	i += 1;
      }
    }
  }

  std::cout << mb << "\n";

  return 0;
}

C++: #include <stdio.h>
#include <iostream>
#include <string>

using namespace std;

int larger(int x, int y){
	if(x > y){
		return x;
	}
	else{
		return y;
	}
}

int main(){
	int N;
	string S;
	cin >> N >> S;
	cout << N << "\n" << S << "\n";//test
	int memo[N+1];
	for(int i = 0; i < N + 1; i++){
		memo[i] = 0;
	}
	for(int i = 1; i < N; i++){
		if(S[i] != S[i-1]){
			memo[i+1] = larger(memo[i-1]+1, memo[i]);
		}
		else{
			memo[i+1] = memo[i];
		}
	}
	cout << memo[N] << "\n";
}

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

int main()
{
    int N;
    string S;
    cin >> N >> S;
    int res = 0;
    for(int i = 0;i + 1 < N;i++){
        if(S[i] != S[i + 1]){
            ++res;
            ++i;
        }
    }
    cout << res << endl;
    return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main(){
    int n, count;
    char ch[100000];
    count = 0;
    scanf("%d",&n);
    for(int i = 0; i < n; i++){
        scanf("%s", ch);
    }
    
    int i = 0;
    while(i < n-1){
        if(ch[i] == 'O'){
            if(ch[i+1] == 'X'){
                count++;
                i += 2;
            }
            else i++;
        }
        if(ch[i] == 'X'){
            if(ch[i+1] == 'O'){
                count++;
                i += 2;
            }
            else i++;
        }
        
    }
    printf("%d\n", count);
    return 0;
}

C++: #include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(void){
	ll n;
	cin >> n;
	char s[n + 1];
	cin >> s;
	ll cnt = 0;
	for(int i = 0; i < n - 1; i++){
		if(s[i] == 'O'){
			if(s[i + 1] == 'X') cnt++, i++;
		} else {
			if(s[i + 1] == 'O') cnt++, i++;
		}
	}
	cout << cnt << endl;
	return 0;
}