We have a string S of length N consisting of uppercase English letters.
How many times does ABC occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

-----Constraints-----
 - 3 \leq N \leq 50
 - S consists of uppercase English letters.

-----Input-----
Input is given from Standard Input in the following format:
N
S

-----Output-----
Print number of occurrences of ABC in S as contiguous subsequences.

-----Sample Input-----
10
ZABCDBABCQ

-----Sample Output-----
2

Two contiguous subsequences of S are equal to ABC: the 2-nd through 4-th characters, and the 7-th through 9-th characters.

Difficulty: introductory

Starter code:

Solutions:
_ = input()
S = input()
print((S.count("ABC")))


# 入力
N = int(input())
S = input()

target = 'ABC'
cnt = 0

# 1~3文字目、2~4文字目...のように１文字ずつスライドさせながら3つの連なる文字列を全探索する
for i in range(0,len(S)-2):
    if S[i:i+3] == target:
        cnt += 1

# カウントする
print(cnt)

import re
n = int(input())
s = input()
res = re.findall(r'ABC',s)
print(len(res))

n = int(input())
s = input()

print(s.count('ABC'))

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

ans = 0

for i in range(N-2):
    if S[i:i+3] == 'ABC':
        ans += 1

print(ans)


# 2020/09/18
# AtCoder Beginner Contest 150 - B

# Input
n = int(input())
s = input()
cnt = 0
abc = 'ABC'

# Calc
for i in range(n-2):
    for j in range(3):
        if s[i+j] != abc[j]:
            break
        if j == 2:
            cnt = cnt + 1

# Output
print(cnt)


N = int(input())
S = input()
print(S.count('ABC'))

n=int(input())
s=input()
ans=s.count('ABC')
print(ans)

N = int(input())
S = input()
ans = S.count('ABC')
print(ans)

n = int(input())
s = input()
cnt = 0
for i in range(0, len(s)-2):
    if s[i] == "A" and s[i+1] == "B"and s[i+2] == "C":
        cnt += 1
print(cnt)


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

print (S.count("ABC"))

def main():
    n = int(input())
    s = input()
    cnt = 0
    for i in range(len(s)):
        if s[i:i+3] == 'ABC':
            cnt += 1
    return cnt
def __starting_point():
    print(main())
__starting_point()

N=int(input())
s=list(input())

cnt=0
for i in range(len(s)-2):
	if s[i]+s[i+1]+s[i+2]=="ABC":
		cnt+=1

print(cnt)

# 文字数Nを取得
N = int(input())

# 文字列Sを取得
S = input()

target = 'ABC'
counter = 0

# 1文字目〜3文字目、2文字目〜4文字目、...というように3文字ずつ比較してスライドするを繰り返すことで全探索する
for i in range(0, len(S)-2):
    if S[i:i+3] == target:
        counter += 1

# カウントを出力
print(counter)

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

S = S.split("ABC")
print(len(S)-1)

N = int(input())
S = input()
ans = 0
for i in range(N-2):
    if S[i:i+3] == 'ABC':
        ans += 1
print(ans)

n=int(input())
s=input()
count=0
for i in range(n-2):
    if s[i:i+3]=="ABC":
        count+=1
print(count)

N = input()
straw = input()
straw = straw.split('ABC')
print(len(straw) - 1)

n=int(input())
s=input()
ans=0
for i in range(n):
  if(s[i]=="A" and i<n-2):
    if(s[i+1]=="B" and s[i+2]=="C"):
      ans+=1
print(ans)

n = int(input())
a = input()
print(a.count("ABC"))

n = int(input())
s = input()
ans = 0

for i in range(0,n-2):
    if s[i] == "A" and s[i+1] == "B" and s[i+2] == "C":
        ans += 1

print(ans)

import re
n = int(input())
s = input()
a = []
ans = 0
for i in range(n):
    if s[i] == 'A':
        a.append(i)
for i in a:
    if s[i:i+3] == 'ABC':
        ans += 1
print(ans)

n = int(input())
s = input()

print((s.count('ABC')))


_=input()
S=input()
cnt = 0
for a,b,c in zip(S[0:],S[1:],S[2:]):
  if "ABC" == a+b+c:
    cnt += 1
print(cnt)

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

print(S.count('ABC'))

n = int(input())
s = input()

print(s.count('ABC'))

n = int(input())
s = input()

print((s.count('ABC')))


N = int(input())
S = input()
print(S.count("ABC"))

n = int(input())
s = input()

count = 0
for i in range(n-2):
    if s[i:i+3] == 'ABC':
        count += 1
print(count)


def __starting_point():
    N = int(input())
    S = input()
    print((S.count('ABC')))


__starting_point()

n = int(input())
S = input()
print(S.count('ABC'))

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

print(S.count('ABC'))

n=int(input())
s=input()
cnt=0
for i in range(n-2):
    if s[i:i+3]=="ABC":
        cnt+=1
print(cnt)

# 文字数Nを取得
N = int(input())

# 文字列Sを取得
S = input()

print(len(S.split('ABC')) - 1)

n = int(input())
s = input()

print(s.count('ABC'))

x = int(input())
y = input()
print(y.count("ABC"))

n = int(input())
lst = list(input())
count = 0
for i in range(0, len(lst)):
    if lst[i - 2] == 'A' and lst[i - 1] == 'B' and lst[i] == 'C':
        count += 1

print(count)


n = int(input())
s = input()

ans = s.count("ABC")
print(ans)

n = input()
s = input()
print(s.count('ABC'))

N = int(input())
S = input()
cnt = 0
for i in range(N-2):
    if S[i:i+3] == "ABC":
        cnt += 1
print(cnt)

n=int(input())
s=input()
print(sum(s[i:i+3]=="ABC" for i in range(n-2)))

# 入力を取得する
N = int(input())
S = input()
print(S.count("ABC"))

n = int(input())
s = input()
ans = s.count('ABC')
print(ans)

N = int(input())
S = str(input())
count = 0


for i in range(N-2):
    if S[i]+S[i+1]+S[i+2] == 'ABC':
        count += 1

print(count)

n = int(input())
s = input()

print(s.count('ABC'))

import numpy as np

N=int(input())
S=input()
count=0
for i in range(N-2):
    if S[i] == 'A' and S[i+1]=='B' and S[i+2]=='C':
        count=count+1
print(count)

N=int(input())
S=input()
count=0
for i in range(N-2):
    if S[i:i+3]=="ABC": count+=1
print(count)

n = int(input())

s = input()

print((s.count("ABC")))


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

ans = 0 
tmp = 0
for i in range(N):
    if S[i] == "A":
        tmp = 1
    elif S[i] == "B" and tmp == 1:
        tmp += 1
    elif S[i] == "C" and tmp == 2:
        ans += 1
        tmp = 0
    else:
        tmp = 0

print(ans)


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

def ans150(N:int, S:str):
    ans_count=0
    while len(S)>=3:
        if S[:3]=="ABC":
            ans_count+=1
            S=S[1:]
        else:
            S=S[1:]
    return ans_count

print(ans150(N,S))

n = input()
s = input()
print(s.count("ABC"))

N = input()
print(input().count("ABC"))

n,s=open(0);print(sum(s[i:i+3]=="ABC"for i in range(int(n)-2)))

n=int(input())
s=input()
count=0
for i in range(n-2):
    if s[i:i+3]=="ABC":
        count+=1
print(count)

n=int(input())
ss=input()
cnt=0
for i in range(len(ss)-2):
    if ss[i]=='A' and ss[i+1]=='B' and ss[i+2]=='C':
        cnt+=1
print(cnt)

# 入力を受け取る
N=int(input())
S=input()

# 切り出した3文字がabcだったらcouontを1upする
count=0

for i in range(len(S)-3+1):
    if S[i]+S[i+1]+S[i+2] == 'ABC':
        count +=1

# countを出力する
print(count)

input()
s = input()
cnt = 0
for i in range(len(s)-2):
    if s[i:i+3]=="ABC":cnt += 1
print(cnt)

n=int(input())
s=input()
count=0
for i in range(n-2):
  if s[i:i+3]=="ABC":
    count+=1
print(count)

n = int(input())
s = input()
ans = 0
for i in range(n-2):
    if s[i:i+3] == 'ABC':
        ans += 1
print(ans)


n = int(input())
s = list(input())
count=0
for i in range(n-2):
    if s[i] == "A":
        if s[i+1] == "B":
            if s[i+2] == "C":
                count+=1
print(count)

n = int(input())
s = input()
cnt = 0
for i in range(n-2):
    if s[i:i+3]=="ABC":
        cnt += 1
print(cnt)

n = int(input())
s = input()
print(s.count('ABC'))

N = int(input())
S = input()
def count():
    return(S.count("ABC"))
print(count())

s=int(input())
n=input()
print((n.count("ABC")))


n = int(input())
s = input()
ans = 0
for i in range(n-2):
  if s[i] =='A' and s[i+1] =='B' and s[i+2] =='C':
    ans =ans+1
print(ans)

n = int(input())
s = input()
cnt = 0
for i in range(0, len(s)-2):
    if s[i] == "A" and s[i+1] == "B"and s[i+2] == "C":
        cnt += 1
print(cnt)


N = int(input())
S = input()
print(S.count("ABC"))

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

cnt = 0
for i in range(N-2):
  if S[i]=='A' and S[i+1]=='B' and S[i+2]=='C':
    cnt += 1
print(cnt)

n = int(input())
s = str(input())
a = 0
for i in range(n - 2):
    if s[i] == 'A' and s[i + 1] == 'B' and s[i + 2] == 'C':
        a += 1
print(a)

N = int(input())
S = input()
ans = 0
for i in range(N-2):
    if(S[i] == "A" and S[i+1] == "B" and S[i+2] == "C"):
        ans += 1
print(ans)

n = int(input())
s = input()
cnt = 0
for i in range(0, n-2):
    if s[i:i+3] == "ABC":
        cnt += 1
print(cnt)


n,s=int(input()),input();count=0
for i in range(n-2):
  if s[i:i+3]=='ABC': count+=1
print(count)

n = int(input())
s = list(input())
cnt = 0
for i in range(n-2):
    if s[i]+s[i+1]+s[i+2] == "ABC":
        cnt += 1
print(cnt)


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

print(S.count("ABC"))

n = int(input())
s= str(input())
count = 0
for i in range(n-2):
    if s[i] == "A" and s[i+1] == "B"  and s[i+2] == "C":
        count += 1
print(count)

def answer(n: int, s: str) -> int:
    return s.count('ABC')


def main():
    n = int(input())
    s = input()
    print((answer(n, s)))


def __starting_point():
    main()

__starting_point()

import re

n = int(input())
text = input()

pattern = "ABC"
result = re.findall(pattern, text)
print(len(result))

n = input()
s = input()

lst = list(s.split('ABC'))

print(len(lst)-1)

n=int(input())
s=input()
print(s.count('ABC'))

N = int(input())
S = input()
print(S.count('ABC'))

n = int(input())
s = input()

count = 0

for i in range(n - 2):
    if s[i: i + 3] == 'ABC':
        count += 1

print(count)


n = int(input())
s = input()

ans = s.count("ABC")
print(ans)

n = int(input())
s = input()

print(s.count('ABC'))

N = int(input())
S = str(input())
print((S.count("ABC")))


n=int(input())
s=input()

l=list(s.split("ABC"))
r=len(l)-1
if r==-1:
    r=0
print(r)

N=int(input())
S=input()
print(S.count('ABC'))

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

answer=S.count("ABC")
print(answer)

n = int(input())
s = input()
print(s.count('ABC'))

n = int(input())
text = input()

print(text.count('ABC'))

n = int(input())
S = list(input())
ans = 0
for i in range(len(S)-2):
  if S[i] == "A":
    if S[i+1] == "B":
      if S[i+2] == "C":
        ans += 1

print(ans)

_ = input()
s = input()
print(s.count('ABC'))

n = int(input())
s = list(input())
b = 0
for a in range(n-2):
    if s[a] == "A" and s[a+1] == "B" and s[a+2] == "C":
        b = b + 1
print(b)

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

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

print(ans)
return


n= int(input())
s = input()
print((s.count("ABC")))
  


n = int(input())
s = input()
count = 0
for i in range(3+len(s)-1):
  portion = s[i:i+3]
  if 'ABC' == portion:
    count += 1
    
print(count)

n = int(input())
s = input()
ans = 0
for i in range(n-2):
    if(s[i]=='A' and s[i+1]=='B' and s[i+2]=='C'):
        ans +=1
print(ans)

n = int(input())
s = input()
ans = 0
for i in range(n-2):
  if s[i:i+3] == "ABC":
    ans += 1
print(ans)

import math
from collections import Counter
from itertools import product

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n = ii()
s = input()
print(s.count("ABC"))

n = int(input())
text = input()

count = 0
for i in range(n-2):
    target = text[i:i+3]
    if target == 'ABC':
        count += 1

print(count)

input();print(input().count('ABC'))