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

ans = 0

for i in range(L - 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 = 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
    else:
        continue
print(ans)

Solution (Python):
def inpl():
    return list(map(int, input().split()))


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

print([a + b + c for a, b, c in zip(S, S[1:], S[2:])].count('ABC'))

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

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

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

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

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' and s[i+1]=='B' and s[i+2]=='C':
        a+=1
print(a)

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

print(S.count('ABC'))

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

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

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

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

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

print(ans)

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

cnt=S.count('ABC')

print(cnt)

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

print(S.count("ABC"))

Solution (Python):
from collections import Counter,defaultdict,deque
import sys
import bisect
import math
import itertools
import string
import queue
import copy
from itertools import permutations, combinations
from heapq import heappop, heappush

sys.setrecursionlimit(10**8)
mod = 10**9+7
 
def inp(): 
    return int(input())
def inpm(): 
    return map(int,input().split())
def inpl(): 
    return list(map(int, input().split()))
def inpls(): 
    return list(input().split())
def inplm(n): 
    return list(int(input()) for _ in range(n))
def inpll(n): 
    return [list(map(int, input().split())) for _ in range(n)]

def main():
    n = inp()
    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):
_ = input()
s = input()
print(s.count("ABC"))

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

print(S.count('ABC'))

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


if __name__ == '__main__':
    solve()

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

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

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

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):
def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

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

N=one_int()
S=one_str()

print(S.count("ABC"))

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

Solution (Python):
words = lambda t : list(map(t, input().split()))
n = int(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):
from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    N = int(input())
    S = input()

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


main()

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

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


a = 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().split('ABC')
print(len(S) - 1)

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

Solution (Python):
N = int(input())
S = input()
cnt = S.count('ABC')
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):
def main():

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

if __name__ == '__main__':
    print(main())

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

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

print(S.count("ABC"))

Solution (Python):
import unittest


class TestB(unittest.TestCase):
    def test_1(self):
        self.assertEqual(think('ZABCDBABCQ'), 2)

    def test_2(self):
        self.assertEqual(think('THREEONEFOURONEFIVE'), 0)

    def test_3(self):
        self.assertEqual(think('ABCCABCBABCCABACBCBBABCBCBCBCABCB'), 5)


def solve():
    data = read()
    result = think(data)
    write(result)


def read():
    n = read_int(1)[0]
    return read_line(n)


def read_int(n):
    return read_type(int, n, sep=' ')


def read_float(n):
    return read_type(float, n, sep=' ')


def read_type(t, n, sep):
    return list(map(lambda x: t(x), read_line().split(sep)))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(data):
    term = 'ABC'
    return data.count(term)


def write(result):
    print(result)


if __name__ == '__main__':
    
    solve()

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] == 'A':
        if 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):
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()

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

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

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

Solution (Python):
n = int(input())
s=input()
ans=0
for i in range(n-2):
    if "ABC"==s[i:i+3]:
        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().split("ABC")
print((N - len("".join(S))) // 3)

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

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

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

print(s.count('ABC'))

Solution (Python):
import re

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

s = re.sub(r"ABC", "", S)
ans = (N - len(s)) // 3
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):
    if s[i:i+3] == "ABC":
        ans += 1
print(ans)

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

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    input()
    s=input()
    print(s.count("ABC"))
main()

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

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


import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
s = input()
ans = 0
for i in range(n):
    if i < 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(len(S)-2):
    tmp = 0
    if S[i]=="A" and S[i+1] == "B" and S[i+2] == "C":
        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):

import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

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

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

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

str = input()

print(str.count("ABC"))

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

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

Solution (Python):
from sys import stdin
import math

n = int(stdin.readline().rstrip())
s = stdin.readline().rstrip()

print(s.count("ABC"))

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

Solution (Python):
l = int(input())
s = input()
res = 0

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

print(res)

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

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

sr = s.replace("ABC", "")

ans = (n - len(sr)) // 3

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):
_ = int(input())
s = input()

print(s.count('ABC'))

Solution (Python):
from sys import stdin
N = int(stdin.readline().rstrip())
S = (stdin.readline().rstrip())
print(S.count("ABC"))

Solution (Python):


import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N = INT()
S = input()

print(S.count('ABC'))

Solution (Python):











import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,hypot,log 
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N = I()
    S = ST()
    print(S.count("ABC"))
if __name__ == '__main__':
    main()

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


stdin = sys.stdin

ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split())) 
rs = lambda: stdin.readline().rstrip()  

N = ri()
S = rs()
answer = S.count('ABC')
print(answer)

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

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


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):
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):
import re
n = int(input())
s = input()
print(len(re.findall("ABC", s)))

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

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

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

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

ans = 0
f = 0
for i in S:
  if i == "A":
    f = 1
  elif f == 1 and i == "B":
    f = 2
  elif f == 2 and i == "C":
    ans += 1
    f = 0
  else:
    f = 0

print(ans)

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

print(S.count("ABC"))

Solution (Python):
n,s=open(0);print(s.count("ABC"))

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

main()

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

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

print(answer)

Solution (Python):

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
write = sys.stdout.write
def ii(): return int(readline())
def mi(): return map(int, readline().rstrip().split())
def li(): return list(readline().rstrip())
def lmi(): return list(map(int, readline().rstrip().split()))
def end(*arg): print(*arg); sys.exit()



def main():
    N = ii()
    s = input().rstrip()
    cnt = 0
    for i in range(N - 2):
        if s[i:i + 3] == "ABC":
            cnt += 1
    print(cnt)
    return


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

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 numpy as np
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:i+3] == "ABC":
        ans += 1
print(ans)

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

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):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect

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

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

want_string = "ABC"
print(string.count(want_string))

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

i = 0
res = 0
while i <= len(S)-2:
    if S[i:i+3] == 'ABC':
        res += 1
        i += 3
    else:
        i += 1

print(res)

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

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

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

print(S.count("ABC"))

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

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

if __name__ == "__main__":
    import sys
    in_str = []
    for line in sys.stdin:
        in_str.append(line)
    cabc(in_str[1])

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


if __name__ == '__main__':
    main()

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

ans = 0
for i in range(n):
    for j in range(i, n + 1):
        if s[i:j] == "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()

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 += 1

print(count)

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

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

print(s.count('ABC'))

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

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
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 [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

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

  return s.count('ABC')


print(main())

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

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

if "ABC" in S:
    ans = S.count("ABC")
else:
    ans = 0
print(ans)

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

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


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


if __name__ == '__main__':
    main()

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

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

print(S.count("ABC"))

Solution (Python):
n=int(input())
s=input()
count=s.count('ABC')
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 = Ans + 1

print(Ans)

Solution (Python):
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    s = str(readline().rstrip().decode('utf-8'))
    print(s.count("ABC"))


if __name__ == '__main__':
    solve()

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

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

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

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

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

print(t)

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

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

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

print(count)

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

Solution (Python):
import sys
sys.setrecursionlimit(1000000000)
import math
from fractions import gcd
from itertools import count
from functools import lru_cache
from collections import defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok


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


main()

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

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

    print(S.count('ABC'))


if __name__ == '__main__':
    main()

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

Solution (Python):

import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

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


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(S):
    return S.count('ABC')


def main():
    read_int()
    S = read_str()
    print(slv(S))


if __name__ == '__main__':
    main()

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

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

Solution (Python):
'''input
2 2
1 2
3 4
3 4
2 1
'''

from sys import stdin, stdout
import gc
from copy import deepcopy
gc.disable()
input = stdin.readline

	

n = int(input().strip())
string = input().strip()
count = 0
for i in range(n):
	if string[i] == 'A':
		if i + 1 < n and string[i + 1] == 'B':
			if i + 2 < n and string[i + 2] == 'C':
				count += 1

print(count)

Solution (Python):
n=int(input())
s=input()
s=s.replace("ABC","PP")
print(n-len(s))

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

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

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

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

    print(S.count('ABC'))

if __name__ == '__main__':
    main()

Solution (Python):
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time
from fractions import gcd



def I(): return int(input())


def MI(): return map(int, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


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


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


YN = ['No', 'Yes']
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']

show_flg = False



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

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

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


if __name__ == '__main__':
    resolve()

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