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 = list(input())
count = 0
for i in range(N):
	try:
		if S[i] == 'A' and S[i+1] == 'B' and S[i+2] == 'C':
			count += 1
	except IndexError:
		pass
print(count)

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

print(ans)

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):
input()
S=input()
res=0
while S.find('ABC')>-1:
    k=S.find('ABC')
    S=S[:k]+S[k+3:]
    res+=1
print(res)

Solution (Python):
i = int(input())
j = input()
print(j.count('ABC'))

Solution (Python):
i = int(input())
j = input()
    
print(j.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 = input()

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

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

Solution (Python):
n=int(input())
hoge=input()
ans=0
for i in range(n-2):
  if(hoge[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):
input()
print(input().count("ABC"))

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

ans = s.count('ABC')

print(ans)

Solution (Python):

import sys
sys.setrecursionlimit(10000000)
INF = 1<<32


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

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

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

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

Solution (Python):

def main():
    _, S = open(0).read().split()
    ans = S.count("ABC")
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):

def main():
    N = int(input())
    S = input().rstrip()
    ans = sum(S[i:i + 3] == "ABC" for i in range(N - 2))
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):


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

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

Solution (Python):
N = int(input())
S = list(input())
ans = 'ABC'

counter = []
for idx in range(N-len(ans)+1):
    three_nums = ''.join(S[idx:idx+len(ans)])
    counter.append(three_nums.count(ans))
print(sum(counter))

Solution (Python):
n = int(input())
s = input()
count = 0
while 'ABC' in s:
    count += 1
    s_index = s.index('ABC')
    s = s[s_index + 3:]
print(count)

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

tmp = 0
count = 0
for i in S:
  if i == "A":
    tmp = 1
  elif i == "B" and tmp == 1:
    tmp = 2
  elif i == "C" and tmp == 2:
    count += 1
    tmp = 0
  else:
    tmp = 0
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())
a=input()
k=0

for i in range(len(a)-2):
    if a[i]=='A':
        if a[i+1]=='B':
            if a[i+2]=='C':
                k+=1
print(k)

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


print(S.count("ABC"))

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

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

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):
N = int(input())
S = input()
S = list(S)
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):
number=int(input().rstrip())
text=input().rstrip()
i=0
count=0
while i<(number-2):
    if text[i]=='A' and text[i+1]=='B' and text[i+2]=='C':
        count+=1
        i+=1
    else:
        i+=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=input()
s=input()

print(s.count('ABC'))

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

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

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):
import re
a = [input() for i in range(2)]
a[0] = int(a[0])
num_abc = re.findall("ABC", a[1])
print(len(num_abc))

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    n = I()
    s = S()

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


print(main())

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

result = S.count("ABC")

print(result)

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

print(s.count("ABC"))

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

Solution (Python):
A = int(input())
B = input()
result = 0
for i in range(A):
    if B[i] == "A" and B[i:i+3] == "ABC":
        result += 1
print(result)

Solution (Python):


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

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

count = 0
com_val = s

while True:
    s = s.replace("ABC", "", 1)
    if s == com_val:
        break
    else:
        count += 1
        com_val = s

print(count)

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

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

print(count)

Solution (Python):

import numpy as np
def fnSolv():
  iNum = int(input())
  sIn  = input()
  iRet = 0
  for i, s in enumerate(sIn):
    if s == 'A':
      if sIn[i:i+3] == 'ABC':
        iRet += 1
  print(abs(iRet))

if __name__ == '__main__':
  fnSolv()

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()
s1=s.replace("ABC","")
a=len(s)-len(s1)
print(int((len(s)-len(s1))/3))

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

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

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

s = input()

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

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

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

print(s.count("ABC"))

Solution (Python):
if __name__ == '__main__':
    n = int(input())
    print(input().count('ABC'))

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 = list(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())
x = list(str(input()))
y = "".join(x)
import re
z = re.findall("ABC", y)
print(len(z))

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

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

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

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

print(s.count("ABC"))

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

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

print(S.count("ABC"))

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

count_num = s.count('ABC')

print(count_num)

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

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

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

Solution (Python):
b=input()
a=input()
print(a.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 = input()
S = input()

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

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

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

Solution (Python):
n = int(input())
string = list(input())
ans = 0
for i in range(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=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):
a = int(input())
b = input()
print(b.count('ABC'))

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

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):
X=input()
c=list(input())
result=0
i=0
while i<len(c)-2:
    if c[i]=='A':
        if c[i+1]=='B' and c[i+2]=='C':
            result+=1
            i+=3
        else:
            i+=1
    else:
        i+=1
print(result)

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

Solution (Python):
no_of_lines = 2
lines = ""
for i in range(no_of_lines):
    lines+=input()+"\n"

lines = lines.splitlines()

N = int(lines[0])
S = lines[1]

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

print(c)

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

Solution (Python):
if __name__ == '__main__':
    
    n = input()
    s = input()
    num = 0
    for i in range(len(s)):
        if 'ABC' in s:
            num += 1
            s = s.replace('ABC', '', 1)
    print(num)

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

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

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

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

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

Solution (Python):
def calc(num, word):
    word_len = len(word)
    none_abc = word.replace("ABC", "")
    none_abc_len = len(none_abc)
    print(int((word_len - none_abc_len) / 3))


num = int(input())
word = str(input())

calc(num, word)

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):
  ans += (S[i:i+3] == "ABC")
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 = input()
s = input()
print(s.count('ABC'))

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

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

Solution (Python):
n=int(input())
t=input()
ans=0
tmp=""
for i in t:
  if i=="A":
    tmp="A"
  elif i=="B":
    if tmp=="A":
      tmp+="B"
    else:
      tmp=""
  elif i=="C":
    if tmp=="AB":
      ans+=1
    tmp=""
  else:
    tmp=""
print(ans)

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]+s[i+1]+s[i+2] == 'ABC':
        count += 1

print(count)

Solution (Python):
import math
import calendar
import fractions

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

print(s.count("ABC"))

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

d = []
count = 0

for x in S:
    d.append(x)
    if len(d) == 3:
        if ''.join(d) == 'ABC':
            count += 1
        d.remove(d[0])


print(count)

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

ans = 0
for i in range(N-2):
    s = S[i:i+3]
    if s == '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()
string = input()
print(string.count("ABC"))

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())
s = input()
cnt = 0
while 'ABC' in s:
  cnt += 1
  s = s.replace('ABC', '', 1)
print(cnt)

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

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

Solution (Python):
import re

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

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()
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):
import sys

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())

sys.setrecursionlimit(10 ** 9)


def main():
    N = INT()
    S = INPUT()

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

    print(cnt)


if __name__ == '__main__':
    main()

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

target = 'ABC'

print(S.count(target))

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
import os,sys

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

Solution (Python):



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


if __name__ == '__main__':
    main()

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

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

print(S.count('ABC'))

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

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

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):
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' and S[i+2] == 'C':
      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 = str(input())
 
i = 0
cnt = 0
 
for i in range(0,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()

print(S.count("ABC"))

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

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

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

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

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

print(s.count("ABC"))

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

m = re.findall("ABC", s)
print(len(m))

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

print(S.count("ABC"))

Solution (Python):
N = int(input())
S = input()
ctr = ptr = 0

def count_ABC(pos, count):
    if (S[pos]=='A' and S[pos+1]=='B' and S[pos+2]=='C'):
        count += 1
        pos += 3
    else :
        pos += 1
    
    return(pos, count)

while (ptr < (N-2)):
    ptr, ctr = count_ABC(ptr, ctr)

print(ctr)

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

Solution (Python):
n = int(input())
s = input()
i = 0
ans = 0
while i<n:
    if 'ABC' in s[i:min(i+3, n)]:
        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 = 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()

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

print(cnt)

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

print(s.count('ABC'))

Solution (Python):
a = input()
b = input()

print(b.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):
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 += 1

print(ans)

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

Solution (Python):


n = int(input())
m = input()
pattern = "ABC"

count = 0
for i in range(len(m) - 2):
    if m[i:i +3] == pattern:
        count += 1
        
print(count)

Solution (Python):
def solve(string):
    n, s = string.split()
    return str(len(s.split("ABC")) - 1)


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))

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

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

if __name__ == '__main__':
    main()

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

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

for val in range(n-2):
	if s[val] != 'A' :
		continue
	elif s[val +1] != 'B' :
		continue
	elif s[val +2] != 'C' :
		continue
	else :
		Answer += 1

print(Answer)

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

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

Solution (Python):
import re
n = int(input())
s = input()
ans = re.findall('ABC',s)

print(len(ans))

Solution (Python):
import sys

N = int(sys.stdin.readline())
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(raw_input())
S = raw_input()
ans = 0
for i in range(0,len(S)-2):
  if S[i] == "A":
    if S[i+1] == "B":
      if S[i+2] == "C":
        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(str(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
    else:
        pass
print(ans)

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

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

res = 0 

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

print(res)

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())
ans = 0
tmp_s = 0
while True:
    tmp = s[tmp_s:].find('ABC')
    if tmp >=0:
        tmp_s+=tmp+3
        ans+=1
    else:
        break
print(ans)

Solution (Python):







N = input()


S = input()

print(S.count('ABC'))

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

sum = 0
order = 0

for c in inp:
  if ord(c) == ord('A'):
    order = 1
  elif ord(c) == ord('A') + order:
    order += 1
    if order == 3:
      order = 0
      sum += 1
  else:
    order = 0
print(sum)

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

ret = 0

for i in range(N):
    for j, s in enumerate('ABC'):
        if i + j >= N:
            break
        if S[i + j] != s:
            break
    else:
        ret += 1

print(ret)

Solution (Python):
n = int(input())
s = str(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=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
    else:
       continue
print(A)

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

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

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

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

Solution (Python):
n = int(input())
s = input()
bf_len = len(s)
af_len = len(s.replace("ABC",""))
ans = (bf_len - af_len) // 3
print(ans)

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

n = int(input().rstrip())
s = input().rstrip()
print(len(s.split('ABC')) - 1)

Solution (Python):
import sys
import math
import heapq
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())
def FLIST(n):
    res = [1]
    for i in range(1, n+1): res.append(res[i-1]*i%DVSR)
    return res
def gcd(x, y):
    if x < y: x, y = y, x
    div = x % y
    while div != 0:
        x, y = y, div
        div = x % y
    return y

N=II()
S=input()
res = 0
for i in range(N-2):
    res += S[i:i+3] == "ABC"
print(res)

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

Solution (Python):
import sys
MAX_INT = int(10e12)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()
s = S()

print(s.count("ABC"))

Solution (Python):
n=int(input())
s=list(input().split())



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

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

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

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

ans = 0
for x, y, z in zip(s[:-2], s[1:-1], s[2:]):
    if x + y + z == "ABC":
        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):
N = int(input())
S = input()
print(S.count("ABC"))

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

Solution (Python):


import sys
import math
import time
import numpy as np
import collections



N = int(raw_input())
S = str(raw_input())



print(S.count("ABC"));

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

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

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

    cnt=0
    for i in range(len(s)-2):
        tmp = s[i] + s[i+1] + s[i+2]
        if tmp == 'ABC':
            cnt +=1
    print(cnt)
if __name__=='__main__':
    main()

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

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

print(count)

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

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

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

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')


def solve():
    n = II()
    s = input().rstrip()
    print(s.count("ABC"))
    return



if __name__ == '__main__':
    solve()

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()
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(1, n-1):
    if s[i - 1] == "A" and s[i] == "B" and s[i+1] == "C":
        count += 1
    else:
        pass
print(count)

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