Problem:
 Score : 200 points    Problem Statement 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 1 10
ZABCDBABCQ      Sample Output 1 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.       Sample Input 2 19
THREEONEFOURONEFIVE      Sample Output 2 0  No contiguous subsequences of S are equal to ABC .       Sample Input 3 33
ABCCABCBABCCABACBCBBABCBCBCBCABCB      Sample Output 3 5

Solution (Python):
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt
from copy import deepcopy


def main():
	count = 0
	num = int(input())
	strings = input()
	
	for i in range(0,num-2,1):
		if strings[i] == "A" and strings[i+1] == "B" and strings[i+2] == "C":	
			count += 1
	print(count)

if __name__ == '__main__':
	main()

Solution (Python):
input();print(input().count('ABC'))

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

print(S.count('ABC'))

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

print(S.count("ABC"))

Solution (Python):
n = int(input())
s = input().replace("ABC", "")

print((n-len(s))//3)

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

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

print(ans)

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

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N = int(readline())
    S = readline().strip()
    
    print(S.count('ABC'))
    return


if __name__ == '__main__':
    main()

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N = int(readline())
    S = readline().strip()

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

    print(ans)
    return


if __name__ == '__main__':
    main()

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

S = input()

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

print(count)

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

print(S.count('ABC'))

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

print(S.count('ABC'))

Solution (Python):
N = int(input())
S = list(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)

Solution (Python):
_=input();print(input().count('ABC'))

Solution (Python):
N=int(input())
S=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)

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

flag =0

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

print(flag)

Solution (Python):

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

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

print(s.count("ABC"))

Solution (Python):
N = int(input())
S = list(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)

Solution (Python):
N=int(input())
S=input()
str="ABC"
c=0
i=2
while i<=N-1:
    if S[i] == "C":
        if S[i-1]=="B":
            if S[i-2]=="A":
                c+=1
                i+=3
            else:
                i+=3
        else:
            i+=3
    else:
        i+=1
print(c)

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

Solution (Python):
n = int(input())
s = input()
counter = 0
for i in range(n):
  j = i +3
  if j > n:
    break
  if s[i:j] == 'ABC':
    counter += 1
print(counter)

Solution (Python):
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)

Solution (Python):
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)

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

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

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

print(S.count('ABC'))

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

Solution (Python):
input()
string = input()

count = 0

for i in range(len(string)):
	if string[i] == 'A':
		if i < len(string)-2 and string[i+1] == 'B':
			if string[i+2] == 'C':
				count += 1


print(count)

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

Solution (Python):
n = int(input())
s = input().replace('ABC','1')
print(s.count('1'))

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

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

Solution (Python):
n = input()
print(input().count("ABC"))

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

count = 0

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

print(count)

Solution (Python):
N = int(input())
S = list(str(input()))

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

Solution (Python):
N=int(input())
S=input()
count=0
for i in range(N):
  if S[i]=='A':
    if S[i+1:i+3]=='BC':
      count+=1
print(count)

Solution (Python):
n=int(input())
s=input()
t="ABC"

print(s.count(t))

Solution (Python):
N = int(input())
S = input()
idx = 0
res = 0
while idx + 2 < N:
    if S[idx] == 'A':
        if S[idx:idx+3] == 'ABC':
            res += 1 
            idx += 3
            continue
    idx += 1
print(res)

Solution (Python):
n = int(input())
s = input()
ans = s.count('ABC')

print(ans)

Solution (Python):
N = int(input())
S = str(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)

Solution (Python):
n = int(input())
x = input()
print(x.count("ABC"))

Solution (Python):
n,s= int(input()),input()
print(s.count("ABC"))

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

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

Solution (Python):
n = int(input())
s = input()
cs = list(s)

ss = []
for i in range(len(cs)-2):
  ss.append(cs[i]+cs[i+1]+cs[i+2])

count = 0
for i in ss:
  if i == "ABC":
    count += 1
  
print(count)

Solution (Python):
N = int(input())
S = input()
count = 0

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

print(count)

Solution (Python):
import sys    
import os     
import math


n = int(input())

S=input()




print(S.count("ABC"))

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

Solution (Python):
N=int(input())
S=input()
c=0
if len(S)>2:
  for i in range(1,N-1):
    if S[i-1]=="A" and S[i]=="B" and S[i+1]=="C":
      c+=1
print(c)

Solution (Python):
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)

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

Solution (Python):
def solve(n,s):
  cnt = 0
  for i in range(len(s)-2):
    if "ABC" == s[i:i+3]:
      cnt+=1
  return cnt
 
n = int(input())
s = input()
ans = solve(n,s)
print(ans)

Solution (Python):
def solve(n,s):
  if "ABC" not in s:
    return 0
  cnt = 0
  for i in range(len(s)-2):
    if "ABC" == s[i:i+3]:
      cnt+=1
  return cnt

n = int(input())
s = input()
ans = solve(n,s)
print(ans)

Solution (Python):
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+=1
print(count)

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

print(S.count('ABC'))

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

Solution (Python):
n=input()
s1= input()

count=0
for i in range(len(s1)-2):
    if(s1[i]=='A' and  s1[i+1]=='B' and s1[i+2]=='C'):
        count=count+1

print(count)

Solution (Python):
import sys
import itertools

import time
import math
 
sys.setrecursionlimit(10 ** 7)
 
from collections import defaultdict
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines




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

ans = 0
for i in range(N):
    if S[i:i+3] == "ABC":
        ans += 1
print(ans)

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

S = input()

print(S.count("ABC"))

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

Solution (Python):
N = int(input())
s = input()
print(s.count('ABC'))

Solution (Python):
n=int(input())
s=list(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)

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

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

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

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

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

Solution (Python):
n=int(input())
s=input().split("ABC")
print(len(s)-1)

Solution (Python):
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)

Solution (Python):
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)

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

output = 0
for index in range((n+1)-3):
    if s[index:index+3] == "ABC":
        output += 1
print(output)

Solution (Python):
import sys

def I(): return int(sys.stdin.readline().rstrip())
def LS2(): return list(sys.stdin.readline().rstrip())  

N = I()
S = LS2()

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)

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

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

Solution (Python):
N=int(input())
S=input()
ans=0
for i in range(N):
    if S[i:i+3]=="ABC":
        ans += 1
print(ans)

Solution (Python):
N=int(input())
S=list(input())
a=0
for i in range(0,N-2):
    if (S[i]+S[i+1]+S[i+2])=='ABC':
        a+=1
print(a)

Solution (Python):


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

for i in range(len(s)):
    if s[i] == 'A':
        try:
            if s[i + 1] == 'B' and s[i + 2] == 'C':
                num += 1
        except:
            pass

print(num)

Solution (Python):
N = int(input())
Ss = input().rstrip()

ans = Ss.count('ABC')
print(ans)

Solution (Python):
A=int(input())
N=input()
ans=N.count("ABC")
print(ans)

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

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

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

print(S.count("ABC"))

Solution (Python):
x=int(input())
arr=input()
print(arr.count('ABC'))

Solution (Python):
N = input()
S = input()
print(S.count('ABC'))

Solution (Python):
def have_ABC_string(n, str):
    count = 0
    for i in range(n-2):
        if str[i] == 'A' and str[i+1] == 'B' and str[i+2] == 'C':
            count += 1
    return count

N = int(input())
S = input()
result = have_ABC_string(N, S)
print(result)

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

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

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

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

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

Solution (Python):
N=int(input())
S=input()
c=0

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

print(c)

Solution (Python):
n = int(input())
s = list(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)

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

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

print(s.count("ABC"))

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


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

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

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

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

c = s.count("ABC")
print("{}".format(c))

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

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

Solution (Python):
def main():
    n = int(input())
    s = input()

    prev = ''
    c = 0

    for i in s:
        if prev == '':
            if i == 'A':
                prev = 'A'
        elif prev == 'A':
            if i == 'A':
                prev = 'A'
            elif i == 'B':
                prev = 'B'
            else:
                prev = ''
        elif prev == 'B':
            if i == 'A':
                prev = 'A'
            elif i == 'C':
                c += 1
                prev = ''
            else:
                prev = ''

    print(c)


if __name__ == '__main__':
    main()

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

print(s.count('ABC'))

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

Solution (Python):
n = int(input())
S = input()
ans = 0
for i in range(len(S)-2):
  if S[i:i+3] == "ABC":
    ans += 1
  else:
    pass
  
print(ans)

Solution (Python):
def solve():
    n = int(input())
    s = input()
    print(s.count('ABC'))

if __name__ == '__main__':
    solve()

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

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

Solution (Python):
n = int(input())
s = input()
abc = 'ABC'
print(s.count(abc))

Solution (Python):
n = int(input())
s = input()
cnt = 0

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

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

Solution (Python):
n=int(input())
s=list(input())
flg=0
ans=0
for i in  range(n):
  if s[i]=="A":
    flg=1
  elif s[i]=="B" and flg==1:
    flg=2
  elif s[i]=="C" and flg==2:
    ans=ans+1
    flg=0 
  else:
    flg=0
print(ans)

Solution (Python):

import sys
from sys import stdin

N = int(stdin.readline().rstrip())
S = stdin.readline().rstrip()
count = 0
for i in range(N - 2):
  if S[i:].startswith('ABC'):
    i += 3
    count += 1
print(count)

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

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

iter = 0
for i in range(n):
  res = s[i:i+3]
  if res == "ABC":
    iter += 1

print(iter)

Solution (Python):
import sys
from itertools import combinations
import math


def I(): return int(sys.stdin.readline().rstrip())


def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))


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


def LS(): return list(sys.stdin.readline().rstrip().split())


n = I()
s = S()

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

Solution (Python):
import sys
from itertools import combinations
import math


def I(): return int(sys.stdin.readline().rstrip())


def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))


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


def LS(): return list(sys.stdin.readline().rstrip().split())


n = I()
s = S()
print(s.count('ABC'))

Solution (Python):
n=int(input())
s=input()
l=[]
count=0
for i in s:
    if i=='A':
        l=['A']
    elif i=='B' and l==['A']:
        l.append('B')
    elif i=='C' and l==['A','B']:
        l=[]
        count+=1
    else:
        l=[]
print(count)

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

Solution (Python):
X = input()
S = input()
print(S.count("ABC"))

Solution (Python):
import re
n=int(input())
s=input()
result = re.findall(r'ABC', s)
print(len(result))

Solution (Python):
N = int(input())
S = list(input())
check = 0
for i in range(N-1):
  if S[i] != "*":
    if S[i:i+3] == ["A","B","C"]:
      check += 1
      S[i:i+3] = ["*"]*3
print(check)

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

print(s.count('ABC'))

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

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

print(cnt)

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

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

Solution (Python):
n=int(input())
s,ans=input(),0

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

Solution (Python):
n = int(input())
X = input()
a = 0
for i in range(n-2):
  if X[i] + X[i+1] + X[i+2] == 'ABC':
    a +=1
  else:
    a +=0
      
print(a)

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

ans=S.replace('ABC','x')
print(ans.count('x'))

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

ans=s.count('ABC')

print(ans)

Solution (Python):
N = int(input())
S = list(input())
count = 0
for i in range(0,N-2):
    if S[i] == "A":
        if S[i+1] == "B":
            if S[i+2] == "C":
                count += 1
print(count)

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

print(s.count("ABC"))

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

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

i = 0
ans = 0
while i + 2 < N:
    s = i
    e = i + 3
    if S[s:e] == 'ABC':
        ans += 1
        i += 3
    else:
        i += 1
print(ans)

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

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

print(s.count("ABC"))

Solution (Python):

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

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

Solution (Python):
n = int(input())
s = input()
k = 0
liss = list(s)
for i in range(len(s) - 2):
    if (liss[i] == 'A') & (liss[i + 1] == 'B') & (liss[i + 2] == 'C'):
        k += 1
print(k)

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

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

print(S.count('ABC'))

Solution (Python):
def resolve():
    import sys
    input = sys.stdin.readline
    
    n = int(input())
    s = input()
    
    
    
    
    
    
    
    

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

    print(cnt)
resolve()

Solution (Python):
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)

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

print(S.count("ABC"))

Solution (Python):

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

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

print(cnt)

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

count = 0
for i in range(len(s) - 2):
    if s[i] == 'A' and s[i+1] == 'B' and s[i+2] == 'C':
        count+=1
print(count)

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

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

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

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

print(S.count('ABC'))

Solution (Python):
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)

Solution (Python):
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 += 1
print(count)

Solution (Python):
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    n = int(input())
    s = list(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)

if __name__ == '__main__':
    main()

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

Solution (Python):
def readinput():
    n=int(input())
    s=input()
    return n,s

def main(n,s):
    i=0
    count=0
    while(i<n):
        p=s[i:].find('ABC')
        
        if(p!=-1):
            i+=p+3
            count+=1
        else:
            break
    return count

if __name__=='__main__':
    n,s=readinput()
    ans=main(n,s)
    print(ans)

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

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

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

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

print(res)

Solution (Python):
N = input()
S = input()
T = "ABC"

res=0
for i in range(0, len(S)):
    if S[i:i+len(T)]==T:
        res+=1

print(res)

Solution (Python):
"""
N = list(map(int,input().split()))
S = [str(input()) for _ in range(N)]
S = [list(map(int,list(input()))) for _ in range(h)] 
print(*S,sep="")
"""

import sys
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()
inf = float("inf") 

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

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

print(S.count("ABC"))

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

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

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

print(s.count("ABC"))

Solution (Python):
N=int(input())
S=str(input())
list_S=list(S)
ans=0

for i in range(N-2):
    if list_S[i]=='A':
        if list_S[i+1]=='B':
            if list_S[i+2]=='C':
                ans += 1
    

print(ans)

Solution (Python):


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

print(s.count('ABC'))

Solution (Python):
N=int(input())
S=input()
count=0
for i in range(N):
    if S[i:i+3]=='ABC':
        count+=1
print(count)

Solution (Python):
N=int(input())
S=input()
count=0
for i in range(N):
  if S[i:i+3]=='ABC':
    count+=1
print(count)

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

Solution (Python):
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)

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

Solution (Python):
import re


def actual(s):
    matched = re.findall('ABC', s)

    return len(matched)

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

print(actual(s))

Solution (Python):
n=input()
a=input()
print(a.count("ABC"))

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

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

print(s.count('ABC'))

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

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

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

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

S = input()

result = 0
for i in range(N):
    
    if S[i:i+3] == 'ABC':
        result += 1
print(result)

Solution (Python):
import sys

input = lambda: sys.stdin.readline().rstrip()


def solve():
    N = int(input())
    S = input()

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


if __name__ == '__main__':
    solve()

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

print(count)

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

ans = S.count("ABC")

print(ans)

Solution (Python):
def main():
    N = int(input())
    S = input()

    print(S.count("ABC"))


if __name__ == "__main__":
    main()

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

Solution (Python):
tam = int(input())
k = input()

print(k.count("ABC"))

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

print(s.count('ABC'))

Solution (Python):
n = int(input())
s = input()
cnt = 0
for i in range(len(s)):
    for j in range(len(s)):
        if s[i : j+1] == "ABC":
            cnt += 1
print(cnt)

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

print(s.count("ABC"))

Solution (Python):
num = input()
input = input()
result = 0
for i in range(len(input) - 2):
    serach = input[i:i+3]
    if serach == "ABC":
        result += 1
print(result)

Solution (Python):
import math
import re
import copy
import sys

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

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

Solution (Python):
s=input()
s2=input()
print(s2.count("ABC"))

Solution (Python):
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)

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

import re
r = re.compile(r"ABC")
s = re.findall(r, S)

print(len(s))

Solution (Python):
n = input()
print(len(input().split("ABC"))-1)

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

Solution (Python):

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

Solution (Python):
import sys

N = int(sys.stdin.readline().rstrip("\n"))
S = sys.stdin.readline().rstrip("\n")
count = 0
for i in range(len(S)-2):
    if (S[i] == 'A') and (S[i+1] == 'B') and (S[i+2] == 'C'):
        count += 1
print(count)

Solution (Python):
n = input()
s = input()
print(s.count('ABC'))

Solution (Python):
input()
print(input().count("ABC"))

Solution (Python):
import sys
import decimal 

def input():
    return sys.stdin.readline().strip()

def main():
    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 += 1
            i += 3
    print(count)

    
    
main()

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

string = 'ABC'
count = 0


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

        
print(count)

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

Solution (Python):
n = int(input())
s = input()
f = "ABC"
cnt = 0
tmp = None
for s_ in s:
    if not tmp and s_ == "A":
        tmp = "A"
    elif tmp == "A" and s_ == "B":
        tmp = "B"
    elif tmp == "B" and s_ == "C":
        cnt += 1
        tmp = None
    elif s_ == "A":
        tmp = "A"
    else:
        tmp = None
print(cnt)

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

Solution (Python):
input()
print(input().count("ABC"))

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

Solution (Python):
import sys

def main():
    N = int(input())
    S = input()

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

    print(cnt)
main()

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

print(S.count('ABC'))

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

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

Solution (Python):
n = int(input())
ln = input()
cou = 0
for i in range(n-2):
    if ln[i:i+3] == 'ABC':
        cou += 1
print(cou)

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

a = 0

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

print(a)

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

print(s.count("ABC"))

Solution (Python):
input()
s = input()
print(s.count('ABC'))

Solution (Python):
def func(S):
    ans = S.count("ABC")
    return ans


if __name__ == "__main__":
    _, S = input(), input()
    print(func(S))

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

print(S.count('ABC'))

Solution (Python):

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

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

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

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

print(S.count('ABC'))

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

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

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

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

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

print(ans)

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

Solution (Python):
N = int(input())
s = input()
print(s.count('ABC'))

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

ans = 0

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

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

print(s.count('ABC'))

Solution (Python):
N=int(input())
S=input()
S=S.replace("ABC","")
print((N-len(S))//3)