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
}

Python: num=int(input())
ox=input()
ans=0
while True:
    if len(ox)<=1:
        break
    a=ox.find("OX",0,2)
    b=ox.find("XO",0,2)
    if a==0 or b==0:
        ox=ox[2:]
        ans+=1
    else:
        ox=ox[1:]

print(ans)

Python: 
def solve():
    N = int(input())
    S = input()
    stomp = 0
    for i in range(1, len(S)):
        pass
    i = 0
    while True:
        if i >= len(S) - 1:
            break
        if S[i] != S[i + 1]:
            stomp += 1
            i += 1
        i += 1
    print(stomp)


if __name__ == '__main__':
    solve()

Python: n = int(input())
s = input()

i = 0
ans = 0
while i+1 < n:
    if s[i:i+2] in ['OX','XO']:
        i += 2
        ans += 1
    else:
        i += 1
print(ans)

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

using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define reps(i, m, n) for (int i = m; i <= n; ++i)

using i64 = long long;
using pii = pair<i64, i64>;

template<class A, class B>inline bool chmax(A &a, const B &b){return b > a ? a = b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b < a ? a = b,1 : 0;}

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod = int(1e9) + 7;

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

  int N;
  string S;
  cin >> N >> S;

  int ans = 0;
  int i = 0;
  while (true) {
    if (S.substr(i, 2) == "OX" || S.substr(i, 2) == "XO") {
      ++ans;
      i += 2;
    }
    else ++i;

    if (i >= N) break;
  }

  cout << ans << "\n";

  return 0;
}

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

int main(void){
  int N;
  cin >> N;
  string S;
  cin >> S;
  int cnt = 0, i = 0;
  for(int i = 0; i < N-1; i++){
    if((S[i] == 'O' && S[i+1] == 'X')||(S[i] == 'X' && S[i+1] == 'O')){
      cnt++;
      i++;
    }
    else{
      continue;
    }
  }
  cout << cnt << "\n";
  return 0;
}

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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }

int N;
string S;
int dp[101010];
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    cin >> N >> S;
    rep(i, N) {
        chmax(dp[i+1], dp[i]);
        if (i + 1 < N && S[i] != S[i+1]) chmax(dp[i+2], dp[i] + 1);
    }
    cout << dp[N] << endl;
    return 0;
}

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

int cnt_circle_cross(int n, string s) {
    bool is_testing = true;
    int result = 0;
    for (int i = 1; i < n; i++)
        if (is_testing) {
            if (s[i - 1] != s[i]) {
                result++;
                is_testing = false;
            }
        } else
            is_testing = true;
    return result;
}

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

    const int val = cnt_circle_cross(n, s);

    cout << val << endl;
}

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

int main() {
  int n;
  string s;
  cin >> n >> s;
  int result = 0;
  int i;
  for (i = 1; i < n; i++) {
    if (s.at(i) != s.at(i - 1)) {
      result++;
      i++;
    }
  }
  cout << result << endl;
  return 0;
}

C++: #include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>

using namespace std;

#define REP(i,n) for(int i=0;i<int(n);i++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
typedef long long ll;
typedef pair<int,int> P;

int a[2030],c[110];

int main(void){
	          int i;

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

	          int N;
	          string s;
	          cin >> N >> s;

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

	          cout << ans << endl;

	          return 0;
}

C++: #define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <utility>
#include <numeric>

using namespace std;
typedef long long llong;
typedef unsigned long long ullong;

const ullong MOD = 1000000000 + 7;

int main()
{
	int x;
	cin >> x;

	string s;
	cin >> s;

	int cnt = 0;
	for (int i = 0; i < s.length(); i++)
	{
		if (s.substr(i, 2) == "OX" || s.substr(i, 2) == "XO")
		{
			cnt++;
			i++;
		}
	}

	cout << cnt << endl;
}

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;
	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]);
		}
	}
	cout << memo[N] << "\n";
}

C++: #include <iostream>
#include <string>
using namespace std;
int main(void){
    // Your code here!
    int N;
    string S;
    const string pat1 = "OX";
    const string pat2 = "XO";
    int cnt = 0;
    
    cin >> N;
    cin >> S;
    
    int i = S.length();
    
    while (i > 0) {
        string search_pat = S.substr(i - 1, 2);
        
        if (search_pat == pat1 || search_pat == pat2) {
            cnt++;
            i--;
        }
        i--;
    }
    cout << cnt << endl;
}