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

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

count = 0
for i,s in enumerate(S):
  if s == 'A' and S[i:i+3] == 'ABC':
    count += 1
print(count)

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

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

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

print(text.count('ABC'))

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

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

print(count)

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

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

Solution (Python):
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 = list(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):
n = int(input())
S = list(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 = int(input())
s = list(input())
count=0
for i in range(n-2):
    if s[i] == "A":
        if s[i+1] == "B":
            if s[i+2] == "C":
                count+=1
print(count)

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

print(s.count("ABC"))

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

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

l=list(s.split("ABC"))
r=len(l)-1
if r==-1:
    r=0
print(r)

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

s = input()

print(s.count("ABC"))

Solution (Python):
n = int(input())
lst = list(input())
count = 0
for i in range(0, len(lst)):
    if lst[i - 2] == 'A' and lst[i - 1] == 'B' and lst[i] == 'C':
        count += 1

print(count)

Solution (Python):




n = int(input())
s = input()
cnt = 0
abc = 'ABC'


for i in range(n-2):
    for j in range(3):
        if s[i+j] != abc[j]:
            break
        if j == 2:
            cnt = cnt + 1


print(cnt)

Solution (Python):
import numpy as np

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

""" 3文字ずつスライスし判定
S = input()
count = 0

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

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

print(s.count('ABC'))

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

Solution (Python):
import re

n = int(input())
text = input()

pattern = "ABC"
result = re.findall(pattern, text)
print(len(result))

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

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

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

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

print(S.count('ABC'))

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

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

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

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


print(count)

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

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

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

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

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

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

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

Solution (Python):
_ = input()
text = input()

print(text.count("ABC"))

Solution (Python):
n = int(input())
s = input()
i = 0
cnt = 0
while i < n:
  if s[i:i+3] == 'ABC':
    cnt += 1
    i += 3
  else:
    i += 1
print(cnt)

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

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

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

print( ABC_count )

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

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

print(ans)

Solution (Python):

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

Solution (Python):
N=int(input())
S=input()
temp=""
ans=0
for i in range(N):
	if S[i]=="A":
		temp="A"
	elif S[i]=="B" and temp=="A":
		temp="B"	
	elif S[i]=="C" and temp=="B":
		temp=""
		ans+=1
	else:
		temp=""

print(ans)

Solution (Python):
t = input()
al = input()
count = 0
for i in range(len(al)):
  if al[i:].startswith('ABC'):
    count += 1
print(count)

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

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

print(s.count("ABC"))

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

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

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

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

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


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

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

while(i < n - 2):
    if(s[i] == 'A' and s[i+1] == 'B' and s[i+2] == 'C'):
        cnt += 1
        if i < n -3:
            i = i+3
        else:
            i += 1
    else:
        i += 1

print(cnt)

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

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

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

cnt=0

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

print(cnt)

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

count = word.count("ABC")
print(count)

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

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

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

Solution (Python):

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


if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
S = input()
if not "ABC" in S:
  print(0)
  exit()
else:
  ans = S.count("ABC")
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 = ans + 1
print(ans)

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

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

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

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


cn = 0

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

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

S = input()
count = 0

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

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

print(s.count('ABC'))

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

Solution (Python):

def calc_digit_sum(num):
    sums = 0
    while num > 0:
        sums += num % 10
        num //= 10
    return sums


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

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

Solution (Python):
input()
s = input()
l = len(s)
s2 = s.replace('ABC', '')
 
l2 = len(s2)
 
print((l-l2) // 3)

Solution (Python):
n = int(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 = 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):
    cnt += s[i:i+3] == 'ABC'

print(cnt)

Solution (Python):


n=int(input())
s=list(input())
ans=["A","B","C"]
count=0
for i in range(n-2):
    cnt=0
    for j in range(len(ans)):
        if s[i+j]==ans[j]:
            cnt+=1
    if cnt ==3:
        count+=1
print(count)

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

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

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

print(cnt)

Solution (Python):
N = 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):
import sys
import re


def resolve(in_):
    N = int(next(in_))
    S = next(in_).strip()

    answer = sum(1 for _ in re.finditer('ABC', S))
    return answer


def main():
    answer = resolve(sys.stdin)
    print(answer)


if __name__ == '__main__':
    main()

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

abc = "ABC"
ans = 0
j = 0

for i in range(N):
    if S[i] == abc[j]:
        j += 1
        if S[i] == "C":
            j = 0
            ans += 1
    elif S[i] == "A":
        j = 1
    else:
        j = 0
print(ans)

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

A= []
A= list(s)



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

print(add)

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

p = "ABC"
ans = 0

for i in range(n - 2):
            if s[i : (i + 3)] == p :
                  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
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):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


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

    print(S.count("ABC"))


if __name__ == '__main__':
    main()

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

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

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

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

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

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

Solution (Python):

from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


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

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


def main():
    solve()


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

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

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

count = 0
for i in range(N-2):

	if S[i:i + 3] == "ABC":
		count = count + 1
print(count)

Solution (Python):
import sys
sys.setrecursionlimit(10**7) 
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right

from collections import deque, defaultdict


from collections import Counter

from itertools import accumulate,combinations,permutations,product

from heapq import heapify,heappop,heappush

from functools import reduce,lru_cache

from decimal import Decimal
from argparse import ArgumentParser

args=ArgumentParser()
args.add_argument('-loc', '--local', type=bool,default=False)
LOCAL=args.parse_args().local

def input(): 
    x=sys.stdin.readline(); 
    if x[-1]=="\n": 
        return x.rstrip() 
    return x
    
def printe(*x):_=print("
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def binr(x): return bin(x)[2:]
def bitcount(x): 
    x= x - ((x >> 1) & 0x5555555555555555)
    x= (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x= (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f 
    x+= (x >> 8); x+= (x >> 16); x+= (x >> 32) 
    return x & 0x7f

def main():
    mod = 1000000007
    

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

print(S.count('ABC'))

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

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

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

main()

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

print(s.count('ABC'))

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

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

Solution (Python):
N = int(input())
S = input()
ans = 0
s = 0
while True:
    x = S.find('ABC', s)
    if x == -1:
        break
    else:
        s = x+1
        ans +=1

print(ans)

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

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

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

Solution (Python):

import sys
sys.setrecursionlimit(10**9)


INF=10**20
def solve(N: int, S: str):
    T = S.replace("ABC","")
    ans = N - len(T)
    ans //= 3

    print(ans)
    return

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



if __name__ == "__main__":
    main()

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

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

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


import math

length = int(input())
total = 0
str = input()
table = list(str)
for i in range(length - 2):
    if table[i] == "A":
        if table[i+1] == "B":
            if table[i+2] == "C":
                total += 1

print(total)

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

print(S.count("ABC"))

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

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

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

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

Solution (Python):
n,s = [input() for _ in range(2)]
print(s.count("ABC"))

Solution (Python):



import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """10
ZABCDBABCQ"""
        output = """2"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """19
THREEONEFOURONEFIVE"""
        output = """0"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """33
ABCCABCBABCCABACBCBBABCBCBCBCABCB"""
        output = """5"""
        self.assertIO(input, output)


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


if __name__ == "__main__":
    
    resolve()

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

cnt=0

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

print(cnt)

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

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

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

print(ans)

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

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

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

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

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

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

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

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



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

Solution (Python):


from typing import *
import collections
import functools
import itertools
import math
import sys

INF = float('inf')


def solve(N: int, S: str):
    return S.count('ABC')


def main():

    sys.setrecursionlimit(10 ** 6)

    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)  
    print(f'{solve(N, S)}')


if __name__ == '__main__':
    main()

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

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

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

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

Solution (Python):
print(input()*0 + str(input().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 enumerate(s) :
    if s[i:i+3] == "ABC":
        count += 1

print(count)

Solution (Python):
import sys, bisect, math, itertools, string, queue, copy








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(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

n = inp()
s = input()
tmp = s.replace('ABC', '1')
ans = 0
for t in tmp:
    if(t == '1'):
        ans += 1
print(ans)

Solution (Python):
import sys, bisect, math, itertools, string, queue, copy








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(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

n = inp()
s = input()

tmp = ''
ans = 0
for st in s:
    l = [tmp, st]
    tmp = ''.join(l)
    if(tmp == 'ABC'):
        ans += 1
    if(len(tmp) >= 3):
        tmp = tmp[1:]
print(ans)

Solution (Python):
N,S = open(0).read().split()
N = int(N)
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(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):
a = int(input())
s = input()
print(s.count("ABC"))

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

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

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

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

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

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

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

    print(S.count("ABC"))


if __name__ == "__main__":
    main()

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

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):
number = int(input())
word = input()
answer = word.count('ABC')
print(answer)

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

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

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

Solution (Python):
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
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(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

n = inp()
s = input()

print(s.count('ABC'))

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

print(s.count('ABC'))

Solution (Python):
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
sys.setrecursionlimit(10**7)

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

def main():
    N = I()
    S = _S()
    print(S.count("ABC"))

main()

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

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

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

print(S.count("ABC"))

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