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)
}

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)

Python: #!/usr/bin/python3

import array
from fractions import Fraction
import functools
import itertools
import math
import os
import sys


def main():
    N = read_int()
    S = inp()
    print(solve(N, S))


def solve(N, S):
    i = 0
    count = 0
    while i < N - 1:
        if S[i] != S[i + 1]:
            count += 1
            i += 2
        else:
            i += 1
    return count


###############################################################################
# AUXILIARY FUNCTIONS

DEBUG = 'DEBUG' in os.environ


def inp():
    return sys.stdin.readline().rstrip()


def read_int():
    return int(inp())


def read_ints():
    return [int(e) for e in inp().split()]


def dprint(*value, sep=' ', end='\n'):
    if DEBUG:
        print(*value, sep=sep, end=end)


if __name__ == '__main__':
    main()

Python: N = int(input())
S = list(input())
cnt = 0

for i in range(N - 1) :
  if(S[i] == "O" and S[i + 1] == "X") :
    S[i] = "l"
    S[i + 1] = "l"
    cnt += 1
  elif(S[i] == "X" and S[i + 1] == "O") :
    S[i] = "l"
    S[i + 1] = "l"
    cnt += 1
  else :
    pass

print(cnt)

Python: N = int(input())
S = input()
dp = [0]*(N+1)
dp[0] = 0
for i in range(N):
    if i < N-1 and S[i] != S[i+1]:
        dp[i+2] = dp[i]+1
    dp[i+1] = max(dp[i+1], dp[i])
print(dp[N])

Python: input()
s = [i for i in input()]
cnt = 0
j = 0
for i in range(len(s)-1):
    if j == 1:
        j = 0
    elif s[i]+s[i+1] == 'OX' or s[i]+s[i+1] == 'XO':
        cnt += 1
        j = 1
print(cnt)

Python: N=int(input())
s=input()
n=0
cnt=0
while n<=len(s)-2:
    if s[n:n+2]=="OX"or s[n:n+2]=="XO":
        cnt+=1
        n+=2
    else:
        n+=1
print(cnt)

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

ans, i = 0, 1
while i < n:
    if s[i-1] != s[i]:
        ans += 1
        i += 1
    
    i += 1

print(ans)

Python: # coding: utf-8
# Your code here!

#数学オリンピック_〇×スタンプ

kosu=int(input())

stamp=input()

i=0;
ans=0;

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

print(ans)

Python: #標準入力
i = int(input())
str1 = input()

#まるばつスタンプの数を数えまるばつスタンプを消す
i = str1.count("OX")
line = str1.split("OX")

#リストに残った要素で文字列を作り、ばつまるスタンプの数を数える
str2 = "".join(line)
print(i + str2.count("XO"))

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

Python: # coding: utf-8
n=int(input())
s=input()
dp=[0 for i in range(n)]
for i in range(1,n):
    if s[i-1]!=s[i]:
        dp[i]=max(dp[i-1],dp[i-2]+1 if i-2>=0 else 1)
    else:
        dp[i]=dp[i-1]
print(dp[-1])

Python: n=int(input())
s=list(input())
cnt=0
def jesus(a,b):
    if (a=='O' and b=='X') or (b=='O' and a=='X'):
        return True
    else:
        return False
i=0
while i+1<n:
    if jesus(s[i],s[i+1]):
        cnt+=1
        i+=1
    i+=1
print(cnt)

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)

Python: def main():
    N = int(input())
    S = input()
    pre = False
    ans = 0
    for i in range(N-1):
        if pre:
            pre = False
            continue
        if (S[i] == 'O' and S[i+1] == 'X') or (S[i] == 'X' and S[i+1] == 'O'):
            ans += 1
            pre = True
    print(ans)


if __name__ == '__main__':
    main()

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

i,cnt=0,0
while i<n-1:
    t=s[i]+s[i+1]
    if t=="OX" or t=="XO":
        cnt+=1
        i+=1
    i+=1
print(cnt)

Python: def found_min(x, y):
    if x == -1 and y == -1:
        return -1
    elif x == -1:
        return y
    elif y == -1:
        return x
    else:
        if x >= y:
            return y
        else:
            return x
n = int(input())
Stamp = input()

OXStamp = 0
index = 0

while True:
    
    i = found_min(Stamp[index:].find("OX"), Stamp[index:].find("XO"))
    if i == -1:
        break
    else:
        OXStamp += 1
        index += i + 2
print(OXStamp)

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

count = 0
flag = 0
for i in range(1, n):
    if flag==1:
        flag = 0
        continue
    if s[i-1] != s[i]:
        count += 1
        flag = 1
print(count)

Python: check = True
cnt = 0

n = int(input())
stamps = input()

while len(stamps)>1:
    if check:
        if stamps[:2] in ["XO", "OX"]:
            cnt += 1
            check = False
    else:
        check = True
    stamps = stamps[1:]

print(cnt)

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

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

maru_batsu = 0
judge_skip = False
for index in range(1, int(N)):
    s0 = S[index - 1]
    s1 = S[index]
    if judge_skip == True:
        judge_skip = False
        continue
    if s0 != s1:
        maru_batsu += 1
        judge_skip = True
print(maru_batsu)

Python: N=int(input())
s=str(input())
S=[]
for i in s:
    S.append(i)

i=0
count=0
while i<N-1:
    if (S[i]=='O' and S[i+1]=='X') or (S[i]=='X' and S[i+1]=='O'):
        count+=1
        i+=2
    else:
        i+=1
print(count)

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)

Python: n = int(input())
s = input()
flag = 0
ans = 0
for i,v in enumerate(s):
    if i == 0:
        temp = v   
    else:
        if v != temp:
            if flag == 0:
                ans += 1
                flag = 1
            elif flag == 1:
                flag = 0
        else:
            if flag == 1:
                flag = 0
        temp = v

print(ans)

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