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

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

print(ans)

Solution (Python):



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

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

count = 0
for i in range(N):
    if S[i] == "A":
        if i + 2 < N  and S[i+1:i+3] == "BC" :
            count += 1

print(count)

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

print(s.count('ABC'))

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

	
 
if __name__ == '__main__':
	main()

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

Solution (Python):
import sys
import socket

hostname = socket.gethostname()

if hostname == 'F451C':
    sys.stdin = open('b1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    N = read_int()
    S = read_str()
    res = S.count('ABC')
    print(res)


main()

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

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,S=open(0).read().split();print(S.count('ABC'))

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

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

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

Solution (Python):
n=int(input())
s=str(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()
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()
s = 0
for i in range(0,N-2):
    if S[i:i+3] == "ABC":
        s += 1
print(s)

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

Solution (Python):
import re

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

S_regex = re.compile(r'ABC')
mo = S_regex.findall(S)

print(len(mo))

Solution (Python):

import sys


def solve(N: int, S: str):
    print(len(S.split('ABC')) - 1)
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    S = next(tokens)  
    solve(N, S)

if __name__ == '__main__':
    main()

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-2):
    if S[i] == "A" and S[i+1] == "B" and S[i+2] == "C":
        count+=1
        
print(count)

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

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

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

Solution (Python):
N=int(input())
S=input()
K=''.join(S.split('ABC'))
print(int((N-len(K))/3))

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:i + 3] == "ABC":
        cnt += 1

print(cnt)

Solution (Python):
import re
n = input()
print(len(re.findall("ABC", input())))

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

x = input()
print(x.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 = input()
print(input().count("ABC"))

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

Solution (Python):
n=int(input())
print(input().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 += 1
print(cnt)

Solution (Python):
N, S = open(0).read().split()
N = int(N)

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

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

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 = input()
print(input().count("ABC"))

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

print(s.count('ABC'))

Solution (Python):
n = int(input())
txt = input()
num = txt[0:n].count("ABC")
print(num)

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):
M = int(input())
S = input()
count=0
for i in range(M-2):
  if S[i:i+3]=="ABC":
    count+=1
print(count)

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

def main():
    print(S.count("ABC"))
    return

if __name__ == "__main__":
    main()

Solution (Python):
n=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):
N = int(input())
S = input()
ans = 0
for i in range(N-2):
    if(S[i:i+3] == 'ABC'):
        ans = ans + 1
print(ans)

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())
L = input()
K = 0
for i in range(N-2):
  if L[i] == "A" and L[i+1] =="B" and L[i+2] == "C":
    K = K+1
print(K)

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=input()
S=input() 
cnt=0 
y=S.find("ABC")
if y==-1:
    print(0)
else:
    while y!=-1:
        S=S.replace(S[:y],"",1)
        S=S.replace("ABC","",1) 
        y=S.find("ABC")
        cnt+=1 
    print(cnt)

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

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

main()

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

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


if __name__ == '__main__':
    main()

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

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

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

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 = str(input())

a = 'ABC'
count = 0

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

print(count)

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

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

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

Solution (Python):





def solv(N, s):
    return len(s.split('ABC')) - 1


if __name__ == "__main__":

    N = int(input())
    s = input()
    ans = solv(N, s)

    print(ans)

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

print(S.count("ABC"))

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

count = 0
for i in range(len(s)-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()

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

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 = 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 = list(input().split("ABC"))
print(len(s)-1)

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

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

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

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

Solution (Python):
n=int(input())
s=str(input())
count=0

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

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):
import re
input()
line = input()
print(len(re.findall('ABC',line)))

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):
"""
author : halo2halo
date : 4, Feb, 2020
"""

import sys






read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
S=readline().decode('utf8')
print(S.count('ABC'))

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

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

print(x)

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

for i in range(0,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
lines = [l.rstrip() for l in sys.stdin.readlines()]
n = int(lines[0])
s = lines[1]

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

print(r)

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' 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())
print(input().count('ABC'))

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
    else:
        count+=0
print(count)

Solution (Python):
n = 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
  else:
    continue

print(cnt)

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()
count = 0

while not S.find("ABC") == -1:
    index = S.find("ABC")
    S = S[:index] + S[index+3:]
    count += 1
print(count)

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

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

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

print(cnt)

Solution (Python):
_ = 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:i + 3] == 'ABC':
        c += 1
print(c)

Solution (Python):
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): 
    return list(map(int,input().split()))
def m(): 
    return map(int,input().split())
def onem(): 
    return int(input())
def s(x): 
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): 
    return " ".join(map(str,x))
def max2(x): 
    return max(map(max,x))
def In(x,a): 
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""



n = onem()

a = input()

print(a.count("ABC"))

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 = input()
S = input()

print(S.count("ABC"))

Solution (Python):

N = input()
S = input()

ans = S.count('ABC')
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 = ans + 1

print(ans)

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


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

print(ans)

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

Solution (Python):
import sys
from io import StringIO
import unittest

def resolve():
    n=int(input())
    s=input()

    print(s.count("ABC"))

    return

resolve()

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

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

    print(ans)

if __name__ == '__main__':
    main()

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=input();s=input()
print(s.count('ABC'))

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

Solution (Python):
_ = int(input())
s = str(input())

ans = 0
for i in range(len(s)-2):
    ans += "ABC" == '{}'.format(s[i:i+3])

print(ans)

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 += 1
print(cnt)

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

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

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

Solution (Python):

import re
import math
from copy import deepcopy
import fractions
import random
from heapq import heappop,heappush
import time
import sys
readline = sys.stdin.readline

alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def fac_list(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
def get_primes(n,type="int"):
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=2):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def join(A,c=" "):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s

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 = input()
print(S.count('ABC'))

Solution (Python):
N = int(input())
S = list(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()
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()
ans = 0
for i in range(n):
    if s[i:i+3] == 'ABC':
        ans += 1
print(ans)

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()
c = 0

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

Solution (Python):
n=int(input())
str=input()
k=str.count("ABC",0,n)
print(k)

Solution (Python):




def main():
    N = int(input())
    S = list(input())
    result = 0
    for i in range(N + 3):
        if S[i:i + 3] == ['A', 'B', 'C']:
            result += 1

    print(result)


if __name__ == "__main__":
    main()

Solution (Python):
n=int(input())
s=input()
cnt=0
if len(s)<= 2:
  pass
else:
  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):
import re
n = int(input())
s = input()

print(len(re.findall('ABC', s)))

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

Solution (Python):
input()
print(input().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):
words = int(input())
text = input()
count = 0
for i in range(len(text) - 2):
  if text[i] == "A" and text[i + 1] == "B" and text[i + 2] == "C":
    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):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
S = input()

S = S.replace("ABC", "

total = 0
for i in S:
	if i=="
		total += 1

print(total)

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

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

print(answer)

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

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

print(answer)

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

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

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

print(s.count('ABC'))

Solution (Python):
import re
 
n = int(input())
s = input()
 
abc = re.compile('ABC')
 
count = len(abc.findall(s))
print(count)

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

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

mm = ["A","B","C"]
cnt = 0
for i in range(N-2):

    if S[i:i+3] == mm:
        cnt += 1

print(cnt)

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

Solution (Python):
N = int(input())
S = str(input())
i = 0
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()
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(sum(1 for i in range(N) if S[i:i+3]=="ABC"))

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

print(cnt)

Solution (Python):
import sys
row = sys.stdin.readline
def read_int(row):
    return int(row().rstrip())

def read_string(row):
    return row().rstrip()
  
N = read_int(row)
S = read_string(row)

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)

Solution (Python):
import sys
import numpy as np
 
if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
 
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+=1

print(cnt)

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 = str(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):
from functools import lru_cache
import sys

sys.setrecursionlimit(10**8)

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

@lru_cache(maxsize=None)
def dp(s):
    result = s.count("ABC")
    return result
print(dp(S))

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

Solution (Python):


from collections import defaultdict

con = 10 ** 9 + 7

def getlist():
	return list(map(int, input().split()))


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

	print(ans)

if __name__ == '__main__':
	main()

Solution (Python):
n=int(input())
s=input()
t=s.split('ABC')
u=''.join(t)
print((n-len(u))//3)

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

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

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

print(s.count('ABC'))

Solution (Python):
l = int(input())
i = input()
result = 0

match = ""
for r in range(l):
  if i[r] == "A" and match == "":
    match += i[r]
  elif i[r] == "B" and match == "A":
    match += i[r]
  elif i[r] == "C" and match == "AB":
    match = ""
    result += 1
  else:
    match = i[r]

print(result)

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 = str(input())

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

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

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

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()
c = S.count("ABC")
print(c)

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

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

Solution (Python):
n = int(input())
s = input()
cnt = 0
while True:
    a = s.find("ABC")
    if a >= 0:
        s = s[a+3:]
        cnt +=1
    else:
        break
print(cnt)

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


S = str(input())

print(S.count('ABC'))

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

Solution (Python):
N = int(input())
S = input()
"""
10
ZABCDBABCQ
"""

num = 0
for i in range(len(S)-2):
    if S[i:i+3] == "ABC":
        num += 1

print(num)

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

Solution (Python):
import sys


def solve(inp):
    N = int(inp.readline().strip())
    S = inp.readline().strip()

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

    return str(r)


def main():
    result = solve(sys.stdin)
    if result:
        print(result)


if __name__ == '__main__':
    main()

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

print(S.count('ABC'))

Solution (Python):
N=int(input())
S=input()
target="ABC"
cnt=0

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

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

Solution (Python):

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

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

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

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

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 math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline






















def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))

def main():
	N = inputInt()
	S = input()
	S = S[:-1]

	tmp = S.split("ABC")
	ans = len(tmp)

	print(ans-1)


if __name__ == "__main__":
	main()

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

Solution (Python):
N = int(input())
S = input()
cnt = 0
num = 0

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

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

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

flag = 0
cnt = 0
for i in s:
    if i == "A" and (flag == 0 or flag == 1):
        flag = 1
    
    elif i == "B" and flag == 1:
        flag = 2
    
    elif i == "C" and flag == 2:
        cnt += 1
        flag = 0
    
    else:
        flag = 0

print(cnt)

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

print(s.count("ABC"))

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

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

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

print(ans)

Solution (Python):
n = 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()
c = 0
for i in range(n-2):
    if s[i:i+3] == "ABC":
        c += 1
print(c)

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

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

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

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

Solution (Python):
import re

input()
S = input()

print(len(re.findall("ABC", S)))

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

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

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