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: n=int(input())
i=0
a=0
s=input()
while i<n-1:
	if s[i]+s[i+1]=="OX" or s[i]+s[i+1]=="XO":
		i+=2
		a+=1
	else:
		i+=1
print(a)

Python: strlen = int(input())
stamp_book = input()

MARU = "O"
BATSU = "X"

count = 0
index = 0

while True:
    if (index + 1) >= strlen:
        break

    if stamp_book[index] != stamp_book[index + 1]:
        count += 1
        index += 2
    else:
        index += 1

print(count)

Python: n = int(input())
s = input()
ans = s.count("OX")
s = s.replace("OX","")
ans += s.count("XO")
print(ans)

Python: N = int(input())
S = list(input().strip())

cnt1 = 0
cnt2 = 1
stamp_0x = 0


#print(S[cnt1]==S[cnt2])
while cnt1 < N:
    if cnt1 < N-1:
        if S[cnt1] != S[cnt2]:
            stamp_0x += 1
            cnt1 += 2
            cnt2 += 2
        
        else:
            cnt1 += 1
            cnt2 += 1
            continue
    else:
        cnt1 += 1

print(stamp_0x)

Python: times = input()
str = input()

depth  = 0
i = 1

while i < len(str):
    if str[i - 1] != str[i]:
        depth += 1
        i += 2
    else:
        i += 1

print(depth)

Python: N = int(input())
S = input()

x0, x1 = -1, -1
cnt = 0
flag = False

for i in range(N):
    if flag == False:
        if i > 0 and S[i] != S[i-1]:
            cnt += 1
            flag = True
    else:
        flag = False
    x0 = x1

print(cnt)

Python: n = int(input())
s = list(input())
if n%2: s+=["?"];n+=1
ans = 0
i = 0
while i<n-1:
    if s[i]+s[i+1] in["OX","XO"]: ans+=1
    else: i-=1
    i+=2
print(ans)

Python: n=int(input())
s=input()
i=0
cnt=0
while i<=n:
    if i==n:
        break
    if s[i:i+2]=='OX' or s[i:i+2]=='XO':
        cnt+=1
        i+=2
    else:
        i+=1
print(cnt)

Python: n=int(input())
S=[]
S=input().split()
a=[]
for d in S[0]:
    a.append(d)
p=[]
for i in range(0,n):
    if a[i]=='O':
        p.append(1)
    else:
        p.append(0)
i=0
k=0
while i<n-1:
    if p[i]+p[i+1]==1:
        k=k+1
        i=i+2
    else:
        i=i+1
print(k)

Python: n = int(input())
s = input()
pre_c = ""
flag = False
ans = 0

for c in s:
    if flag:
        if pre_c != c:
            ans += 1
            flag = False
            pre_c = c
    else:
        flag = True
        pre_c = c

print(ans)

Python: N = int(input())
S = list(input())
# print(N)
# print(S)

from collections import deque

cnt = 0  # マルバツスタンプの数

que = deque()

for s in S:
	if len(que) == 0:
		que.append(s)
	else:
		t = que.pop()
		if s != t:
			cnt = cnt + 1
		else:
			que.append(t)
#			que.append(s)

print(cnt)

Python: n=int(input())
input_str = input()
i = 0
count = 0
while True:
    if (n - i) <= 1:
        print(count)
        break
    if input_str[i:(i+2)] == 'OX' or input_str[i:(i+2)] == 'XO':
        count += 1
        i += 2
    else:
        i += 1

Python: #! /usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import math 

def main():
   n= int(input())
   str = input()
   ans = 0
   last =str[0]
   for i in range(n):
       if( str[i] != last):
           ans +=1
           if(i+1 >= n): break;
           i += 1
           last = str[i]
       else:
           last = str[i] 
   print(ans)

if __name__ == '__main__':
    main()

Python: from collections import Counter

N = int(input())
S = input()

counter = 0
prev = S[0]
i = 1
while i < N:
    if S[i] == prev:
        prev = S[i]
        i += 1
    else:
        if i < N - 1:
            prev = S[i + 1]        
        counter += 1
        i += 2
print(counter)

Python: N = int(input())
inji = input()

i = 0
cnt = 0
while i + 1 < N:
    if inji[i:i+2] in ["XO","OX"]:
        i += 2
        cnt += 1
    else:
        i+=1
print(cnt)

Python: N=int(input())
ox=input()



count=0
skip=[False]*N
for i in range(N):
    if skip[i]:
        continue
    if i==N-1:
        break
    if ox[i]=='O':
        if ox[i+1]=='X':
            count+=1
            if i==N-1:
                break
            skip[i+1]=True
            
            continue
        else:
            continue
    else:
        if ox[i+1]=='O':
            count+=1
            if i==N-1:
                break
            skip[i+1]=True
            continue
        else:
            continue

print(count)

Python: # -*- coding: utf-8 -*-
# 学籍番号 17D8101029G 石塚 博之 ID: mcatpolo 言語: python3

N = int(input())
S = list(input())
cnt = int(0)
S.append('Z')
i = int(0)

while i<N:
    if S[i] == 'O' and S[i+1] == 'X':
        cnt+=1
        i+=2
    elif S[i] == 'X' and S[i+1] == 'O':
        cnt+=1
        i+=2
    else:
        i+=1

print(cnt)

Python: input()
s = input()
ans = 0
prev = None
flag = False
for c in s:
    if flag and prev != c:
        ans += 1
        flag = False
    else:
        flag = True
    prev = c
print(ans)

Python: n = int(input())
mb = str(input())

cnt = 0
g = 0

for c in mb:
  if c == "O":
    if g == -1:
      cnt = cnt + 1
      g = 0
    else:
      g = 1
  else:
    if g == 1:
      cnt = cnt + 1
      g = 0
    else:
      g = -1

print(cnt)

Python: N=int(input())
S=input()
l=len(S)

flag=""
count=0

for i in range(l):
    if S[i]=="O" and flag=="X":
        count+=1
        flag=""
    elif S[i]=="O" and flag=="":
        flag="O"
    elif S[i]=="X" and flag=="O":
        count+=1
        flag=""
    elif S[i]=="X" and flag=="":
        flag="X"
print(count)

Python: N=int(input())
M=input()
x=list(M)
cnt=0
a=list()
for i in x:
    a.append(i)
    try:
        if (a[0]=='O' and a[1]=='X') or (a[0]=='X' and a[1]=='O'):
            cnt+=1  
            a=[]
        elif a[1]=='O':
            a=[]
            a.append(i)
        elif a[1]=='X':
            a=[]
            a.append(i)
    except:
        continue
print(cnt)

Python: N=int(input())
S=input()
i=0
oxcnt=0
while i+1<N:
    if S[i:i+2]in['OX','XO']:
        i+=2
        oxcnt+=1
    else:
        i+=1
print(oxcnt)

Python: N = int(input())
S  = input()

INF = 10**10
dp = [-INF] * (N+1)
dp[0] = 0
prev = S[0]
for i in range(N):
    # i = 0のときここを通ることはないのでOK
    if S[i] != prev:
        dp[i+1] = dp[i-1] + 1
    else:
        dp[i+1] = dp[i]
    prev = S[i]
print(dp[N])

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

cnt = 0
i = 0

while i < N - 1:
    if not s[i] == s[i + 1]:
        cnt += 1
        i += 2
    else:
        i += 1

print(cnt)

Python: N=int(input())
S=input()
count=0
i=0
while i<N-1:
    if S[i]+S[i+1]=="OX" or S[i]+S[i+1]=="XO":
        count+=1
        i+=2
    else:
        i+=1
print(count)

Python: n=int(input())
k=input()
cnt=0
i=0
while i<len(k)-1:
    t=k[i]+k[i+1]
    if t=='OX' or t=='XO':
        cnt+=1
        i+=2
    else:
        i+=1
print(cnt)

Python: n = int(input())
s = input()[::-1]

cnt = 0
while True:
    if s[:2] in  ["OX", "XO"]:
        s = s[2:]
        cnt += 1
    else:
        s = s[1:]

    if s == "":
        break

print(cnt)

Python: import sys
input = sys.stdin.readline

def main():
    N = int(input())
    s = "**" + input().strip()

    dp = [0] * (N+2)

    for i in range(N+2):
        if s[i-1:i+1] == "OX" or s[i-1:i+1] == "XO":
            dp[i] = max(dp[i-1], dp[i-2] + 1)
        else:
            dp[i] = dp[i-1]
    # print(dp)
    print(dp[-1])

if __name__ == "__main__":
    main()

Python: N = int(input())
S = input()

ans = 0
i = 0
while i < N-1:
    if S[i] == S[i+1]:
        i += 1
    else:
        ans += 1
        i += 2

print(ans)