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

Solution (Python):
def main():
    n = int(input())
    chars = input()
    cnt = 0

    for i, c in enumerate(chars[0:-2]):
        if c == 'A' and chars[i + 1] == 'B' and chars[i + 2] == 'C':
            cnt += 1
    print(cnt)


main()

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

    S = S.replace('ABC','-')

    print(S.count('-'))

if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
s = input()
target = 'ABC'

res = 0
start=0
while True:
    next = s.find(target,start)
    if next == -1:
        break
    res += 1
    start = next + 3

print(res)

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

print((N - len(S.replace('ABC', ''))) // 3)

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

print((N - len(S.replace('ABC', ''))) // 3)

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

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

Solution (Python):
N = int(input())
S = input()
print(len(S.split('ABC'))-1)

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

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

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

Solution (Python):
def wczytaj_liste(): 
    wczytana_lista = input()
    lista_znakow = wczytana_lista.split()
    ostateczna_lista = []
    for element in lista_znakow:
        ostateczna_lista.append(int(element))
    return ostateczna_lista 

def ABC():
    N = wczytaj_liste()[0]
    S = input()
    odp = 0 
    for i in range(N-2):
        if S[i] == 'A':
            if S[i+1] == 'B':
                if S[i+2]=='C':
                    odp += 1
    print(odp)
    
ABC()

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



num = b.count('ABC')
print(num)

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

result = S.count("ABC")

print(result)

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

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

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

Solution (Python):
import sys

def input():
    return sys.stdin.readline()[:-1]

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

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

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

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

Solution (Python):
import re

n = int(input())
s = input()
result = re.findall('ABC', s)
print(len(result))

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

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

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

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

ans = 0

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

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


n = input()
s = input()

results = re.findall(r"ABC", s)

print(len(results))

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()
index = -1
if "ABC" in S:
  S = S.split("ABC")
  print(len(S)-1)
  
  
else:
  print("0")

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=int(input())
S=input()
print(sum(S[x:x+3]=="ABC" for x in range(N-2)))

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

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

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

Solution (Python):
def main():
    N = int(input())
    S = input()
    ls = []
    for i in range(N-2):
        if S[i]=="A":
            ls.append(i)

    ans = 0
    for i in ls:
        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(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()

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

print(abc_count)

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

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=list(input())
x=count=0
search_word=["A","B","C"]
 
for x in range(N-2):
  if S[x]==search_word[0] and S[x+1]==search_word[1] and S[x+2]==search_word[2]:
    count+=1
  x+=1
 
print(count)

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

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

count=0

for i in range(0, 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()
ans=0
for i in range(n-2):
    if s[i] is 'A' and s[i+1] is 'B' and s[i+2] is 'C':
        ans+=1
    else:
        continue
print(ans)

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

print(cnt)

Solution (Python):
import re
n = int(input())
s = input()
c = 0
for i in re.split('(ABC)',s):
    if i == "ABC":
        c += 1

print(c)

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

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

print(X.count('ABC'))

Solution (Python):
read = input 
rn = lambda :list(map(int, read().split()))
n, = rn()
s = read()
ans = 0
for i in range(n):
    if 'ABC' == s[i:i+3]:
        ans += 1
print(ans)

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

Solution (Python):
import re

N = input()
S = input()

ls = re.findall(r"ABC", S)

print(len(ls))

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

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

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

Solution (Python):

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

Solution (Python):


n=int(raw_input())
s=raw_input()
cnt=s.count('ABC')
print cnt

Solution (Python):


"""
name: A-500.py
プログラムの説明
"""

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

    print(S.count('ABC'))

if __name__ == '__main__':
    main()

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

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

Solution (Python):
num = int(input())
str = input()

cnt = 0
for i in range(num - 2):
  word = str[i] + str[i+1] + str[i+2]
  if(word == 'ABC'):
    cnt = cnt + 1

print(cnt)

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

Solution (Python):








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

print(S.count('ABC'))

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

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

Solution (Python):
import sys

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

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
flag = 0
for i in range(n):
  if s[i] == "A":
    flag = 1
  elif s[i] == "B" and flag == 1:
    flag = 2
  elif s[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 = int(input())
l = input()
a = ''
count = 0
for i in l:
  a += i
  if 'ABC' in a:
    a = ''
    count += 1
print(count)

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

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

print(res)

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

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

print(ans)

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

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

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

cnt = 0
tmp = ""
for elem in s:
  if "A" == elem:
    tmp += elem
  elif "B" == elem and tmp != "":
    if tmp[-1] == "A":
	    tmp += elem
    else:
      	tmp = ""
  elif "C" == elem and tmp != "":
    if tmp[-1] == "B":
    	cnt += 1
    tmp = ""
  else:
    tmp = ""
print(cnt)

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

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

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

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

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

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

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

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

print(ans)

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

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

print(c)

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

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

start = -1
count = 0
while True:
    start = S.find('ABC', start + 1)
    if start != -1:
        count += 1
    else:
        break

print(count)

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

Solution (Python):
N, S = open(0).read().split()
SEARCH_STR = "ABC"
print( S.count( SEARCH_STR ) )

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

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

Solution (Python):
def resolve():
    _, S = [input() for i in range(2)]

    print(S.count('abc') + S.count('ABC'))


if __name__ == "__main__":
    resolve()

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()
counter = 0
for i in range(N - 2):
    if S[i] == 'A' and S[i + 1] == 'B' and S[i + 2] == 'C':
        counter += 1

print(counter)

Solution (Python):
N = int(input())
S = input()
count = int(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()
s += "--"
ans = 0

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

Solution (Python):
from sys import stdin
n = int(stdin.readline().rstrip())
s = str(stdin.readline().rstrip())
ans = 0
for i in range(n-2):
    tri = s[i]+s[i+1]+s[i+2]
    if tri == "ABC":
        ans += 1
    else:
        pass

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

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

print(count)

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

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

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

count = 0

for i in range(0, 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()

ret = 0
n = S.find("ABC")
while n != -1:
    ret += 1
    n = S.find("ABC", n + 1)

print(ret)

Solution (Python):
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7


n = int(sys.stdin.buffer.readline())
s = sys.stdin.buffer.readline().decode().rstrip()

ok = 0
for i in range(len(s)):
    if s[i:i+3] == 'ABC':
        ok += 1
print(ok)

Solution (Python):


from collections import deque, defaultdict
import itertools as ite
import sys
import math
from decimal import *

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

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

Solution (Python):
from __future__ import print_function

import sys
input = sys.stdin.readline

def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return















































def main():
    n=int(input())
    s=input().strip()
    cnt=0
    for i in range(0,n):
            if s[i:i+3]=="ABC":
                cnt+=1
            else:
                pass
    print(cnt)
    return

if __name__ == '__main__':
    main()

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

Solution (Python):
from heapq import heappush, heappop
from collections import deque
import re
import math
import functools


def sRaw():
    return input().rstrip("\r")


def iRaw():
    return int(input())


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


def isRaw():
    return list(map(int, ssRaw()))


INF = 1 << 29


def mk1d(n, val=INF):
    return [val for i in range(n)]

def mk2d(h, w, val=INF):
    return [[val for i in range(w)]for i in range(h)]

DIV = 998244353


def convolve(a, b):
    p, g = 1107296257, 5
    n0, n1 = len(a), len(b)
    n = 1 << (max(n0, n1) - 1).bit_length() + 1
    a = a + [0] * (n-n0)
    b = b + [0] * (n-n1)
    w = pow(g, (p - 1) // n, p)
    invw = pow(w, p-2, p)

    def fft(f):
        d = n // 2
        v = w
        while d >= 1:
            u = 1
            for i in range(d):
                for j in range(i, n, 2*d):
                    f[j], f[j+d] = (f[j] + f[j+d]) % p, u * (f[j] - f[j+d]) % p
                u = u * v % p
            v = v * v % p
            d //= 2

    def ifft(f):
        d = 1
        while d < n:
            v = pow(invw, n // (2 * d), p)
            u = 1
            for i in range(d):
                for j in range(i, n, 2*d):
                    f[j+d] *= u
                    f[j], f[j+d] = (f[j] + f[j+d]) % p, (f[j] - f[j+d]) % p
                u = u * v % p
            d *= 2

    fft(a), fft(b)
    for i in range(n):
        a[i] = a[i] * b[i] % p
    ifft(a)
    invn = pow(n, p - 2, p)
    return [a[i] * invn % p for i in range(n0 + n1 - 1)]


def main():
    N = iRaw()
    S = sRaw()
    ans = S.count("ABC")
    return ans

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

Solution (Python):
n = int(input())
s = list(input())
type = "A"
count = 0
for char in s:
    if char == "A":
        type = "B"
    elif char == "B" and type == "B":
        type = "C"
    elif char == "C" and type == "C":
        count += 1
        type = "A"
    else:
        type = "A"
print(count)

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

result=0

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

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

Solution (Python):
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[] for _ in range(num)]
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))



N = I()
S = str(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()
print(s.count("ABC"))

Solution (Python):
import re

pattern = r"ABC"

input()  
string = input()


li = re.findall(pattern, string)

print(len(li))

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

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

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

Solution (Python):



from collections import deque

N = int(input())
A = deque(list(input()))
num, tmp, ans = 0, 0, 0

for i in range(len(A)):
    tmp = A.popleft()
    if num == 0 and tmp == 'A':
        num = 1
    elif num == 1 and tmp == 'B':
        num = 2
    elif num == 1 and tmp == 'A':
        pass
    elif num == 2 and tmp == 'C':
        num = 0
        ans += 1
    else:
        num = 0
print(ans)

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

for i in range(n):

  if s[i:i+3].find("ABC") ==0:
    cnt = cnt+1
print(cnt)

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


if __name__ == "__main__":
    main()

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()
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):
n = int(input())
s = input()
ans = 0
for i in range(n-2):
  if s[i] == 'A' and s[i+1] =='B' and s[i+2] == 'C':
    ans += 1
print(ans)

Solution (Python):

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

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

cnt = 0
for i in range(n - 2):
    num = 1
    if s[i] != "A":
        num = 0
    if s[i + 1] != "B":
        num = 0
    if s[i + 2] != "C":
        num = 0    
    cnt += num

print(cnt)

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

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

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

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

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

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
    else:
        continue
print(count)

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

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

print(Ss.count('ABC'))

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

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

print(lst.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):
def check_substring(s,i):
  if s[i]=='A' and s[i+1]=='B' and s[i+2]=='C':
    return True
  else:
    return False
no = 0
n = int(input())
s = input()
for i in range(n-2):
  if check_substring(s,i)==True:
    no+=1
print(no)

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

import string
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 = str(input())
abc = []
for i in range(N-2):
  if S[i] == 'A':
    if (S[i+1] =='B') and (S[i+2] == 'C'):
      abc.append(i)
ans = len(abc)
print(ans)

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

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

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

Solution (Python):
_ = 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(S.count('ABC'))

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

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

Solution (Python):

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

Solution (Python):
N = int(input())
S = input()
import re
print(len(re.findall('ABC',S)))

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

N = int(readline())
S = list(map(lambda x: ord(x)-65, readline().strip()))

ans = 0
for i in range(N-2):
    for j in range(3):
        if S[i+j] != j:
            break
    else:
        ans += 1
print(ans)

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

start = 0
ans = 0
while True:
    start = s.find('ABC', start)
    if start < 0:
        break
    ans += 1
    start += len('ABC')
print(ans)

Solution (Python):
import re


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

regex = re.compile(r'ABC')
res = regex.findall(S)

print(len(res))

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

Solution (Python):
N = int(input())
S = input()
ans = 0
i = 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(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):
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7 
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    n=int(input())
    S=input()

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

    print(ans)
resolve()

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

Solution (Python):
import sys

n, s = sys.stdin.read().split()
n = int(n)

def main():
    return s.count('ABC')

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

Solution (Python):
import sys

n, s = sys.stdin.read().split()
n = int(n)

def main():
    return s.count('ABC')

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

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

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

a = s.count('ABC')

print(a)

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

result = text.count("ABC")

print(result)

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

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

print(ans)

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

print(s.count("ABC"))

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

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

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

p = 0
c = 0
for i in range(N):
    if S[i] == 'A':
        p = 1
    elif p == 1 and S[i] == 'B':
        p = 2
    elif p == 2 and S[i] == 'C':
        c += 1
        p = 0
    else:
        p = 0

print(c)

Solution (Python):
a=int(input())
b=input()
count=0
for i in range(a-2):
  if b[i]=='A' and b[i+1]=='B' and b[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()

count = 0;
for n in range(N - 2):
  if S[n:n+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()
ABC = 'ABC'

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

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

count = 0

while True:
    index_ABC = S.find('ABC')
    if index_ABC != -1:
        S = S[:index_ABC] + S[index_ABC + 3:]
        count += 1
    else:
        break

print(count)

Solution (Python):
_,s=open(0);print(s.count('ABC'))

Solution (Python):
print(open(0).read().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):
import re

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

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

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

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

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

Solution (Python):
def count(s, idx):
	ac = 0
	step = 0
	bc = 0
	cc = 0
	c = 0
	while(idx < len(s) and step < 3):
		if s[idx] == 'A' and bc == 0 and cc == 0:
			ac = 1
		elif s[idx] == 'B' and cc == 0 and ac == 1:
			bc = 1
		elif s[idx] == 'C' and bc == 1 and ac == 1:
			cc = 1
		idx += 1
		step += 1
	c = ac + bc + cc
	if c == 3:
		return 1
	return 0

n = int(input())
s = input()
summ = 0
for i in range(n):
	if s[i] == 'A':
		if count(s, i) == 1:
			summ += 1
print(summ)

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

Solution (Python):
import sys

input = sys.stdin.readline

ri = lambda: int(input())
rs = lambda: input().rstrip()
ril = lambda: list(map(int, input().split()))
rsl = lambda: input().rstrip().split()
ris = lambda n: [ri() for _ in range(n)]
rss = lambda n: [rs() for _ in range(n)]
rils = lambda n: [ril() for _ in range(n)]
rsls = lambda n: [rsl() for _ in range(n)]

n = ri()
s = rs()
print(s.count('ABC'))