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

Solution (Python):
n = int(input())
s = input()      
pattern = list('ABC')          
cnt = 0

for i in range(n-len(pattern)+1):
    if s[i] == pattern[0]:
        if s[i+1] == pattern[1]:
            if s[i+2] == pattern[2]:
                cnt += 1

print(cnt)

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

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

Solution (Python):
n=int(input())
s=input()
i=0
res=0
while i>=0:
  i=s.find("ABC")
  if i >= 0:
    res += 1
    s=s[i+3:]
print(res)

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

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

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

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

Solution (Python):
x = int(input())
s=list(input())
tmp1 = s[0]
tmp2 = s[1]
tmp3 = s[2]
c = 0
if tmp1+tmp2+tmp3 == 'ABC':
        c += 1
for i in range(len(s)-3):
    tmp1 = tmp2
    tmp2 = tmp3
    tmp3 = s[i+3]
    if tmp1+tmp2+tmp3 == 'ABC':
        c += 1
    else:
        continue
print(c)

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

print(s.count('ABC'))

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

print(S.count('ABC'))

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

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

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

print(count)

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

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

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

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):
def main():
    length = int(input())
    sentence = input()

    counter = 0
    for i in range(length - 2):
        if sentence[i:i+3] == 'ABC':
            counter += 1

    print(counter)


if __name__ == '__main__':
    main()

Solution (Python):



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


abc_count = 0


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


print(abc_count)

Solution (Python):
import math
import copy
from copy import deepcopy
import sys
import fractions

from functools import reduce

import decimal
import heapq
import collections
import itertools
from operator import mul

sys.setrecursionlimit(100001)







def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList




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(sum(s[i:i+3]=='ABC' for i in range(n-2)))

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

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

print(x)

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

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

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

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

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

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

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

    print(cnt)


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):
def main():
    num = int(input())
    s = input()
    cnt = 0
    for i in range(len(s) - 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 = input()
s = input()

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

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

print(S.count('ABC'))

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

s1 = s.replace('ABC','1')
print(s1.count('1'))

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

def dfs(s):
    if len(s) < 2:
        return 0
    elif s[:3] == 'ABC':
        return 1 + dfs(s[3:])
    else:
        return dfs(s[1:])

print(dfs(s))

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

Solution (Python):
import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)

i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()

N = i_i()
S = i_s()

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



import sys


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


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

    abc_count = s.count("ABC")

    print(abc_count)

if __name__ == "__main__":
    resolve()

Solution (Python):


def solve():
    N = int(input())
    S = input()
    spl = S.split("ABC")
    print(len(spl)-1)


if __name__ == "__main__":
    solve()

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

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

cnt = 0

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

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

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

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




sl=list(input())

org=["A","B","C"]
ans=0
for i in range(n-2):
    templ=sl[i:i+3]
    if templ==org :
        ans+=1
print(ans)

Solution (Python):
N = int(input())
s = input()
ans = 0
if N < 3:print(0);exit()
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:n+3] == 'ABC': cnt = cnt + 1
print(cnt)

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

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

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

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


def solve(N: int, S: str):
    counter = 0
    for i in range(N-2):
        if S[i:i+3] == 'ABC':
            counter += 1
    print(counter)
    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()

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

print(count)

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

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):
def main():
    N = int(input())
    S = input()
    ct = 0
    for i in range(N-2):
        p = S[i:i+3]
        if p == 'ABC':
            ct += 1

    print(ct)
    

main()

Solution (Python):
from sys import stdin

lines = stdin.readlines()

n = int(lines[0].rstrip())
s = str(lines[1].rstrip())

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

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

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

print(res)

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

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

Solution (Python):

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

Solution (Python):
import re

N = input()
S = input()
m = re.findall(r"ABC", S)

print(len(m))

Solution (Python):

a = int(input())
s = input()

print(s.count("ABC"))

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

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

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

s = S.replace('ABC', ',').split(',')

print(len(s) - 1)

Solution (Python):
import sys
import re
from decimal import *

l = sys.stdin.readline()
l = sys.stdin.readline()


s = l

state = 0
count = 0
for i in s:
  if(i == 'A'):
    state = 1
  else:
    if(i == 'B' and state == 1):
      state = 2
    else:
      if(i == 'C' and state == 2):
        state = 0
        count += 1
      else:
        state = 0

print(count)

sys.stdout.flush()

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

print(s.count('ABC'))

Solution (Python):



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

count_ABC = 0
for i in range(len(S)-2) : 
    if S[i] == "A" and S[i+1] == "B" and S[i+2] == "C" : 
        count_ABC += 1
        
print(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()
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())
print(input().count('ABC'))

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

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

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, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
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
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

n = INT()
s = STR()
i = 0
ans = 0
while i < n - 2:
    if s[i:i + 3] == 'ABC':
        ans += 1
        i += 3
    else:
        i += 1
print(ans)

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

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

print(S.count('ABC'))

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

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

print(ans)

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

ikeda = text.split("ABC")
out = len(ikeda) - 1

print(out)

Solution (Python):
n=int(input())
s=list(input())
count=0
for i in range(n-2):
  if i<=48 :
    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")
if ans > 0:
    print(ans)
else:
    print(0)

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

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

print(t)

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

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

print(S.count('ABC'))

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

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

print(ans)

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

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

print(s.count("ABC"))

Solution (Python):
from collections import Counter
n = int(input())
s = input()
print(s.count("ABC"))

Solution (Python):
lenghts = int(input())
document = input()

count = 0
for start in range(lenghts -2):
  if document[start: start+3] == 'ABC':
    count += 1
  
print(count)

Solution (Python):


input_line = int(input())

Line = list(input())



count = 0

for i in range(input_line - 2):
    if Line[i] == "A":
        if Line[i+1] == "B":
            if Line[i+2] =="C":
                count += 1

print(count)

Solution (Python):
n=int(input())
s = input().split('ABC')
count = -1
for i in s:
    count += 1
print(count)

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

count = 0
i = 0
while i < N - 2:
    if S[i] == 'A' and S[i + 1] == 'B' and S[i + 2] == 'C':
        count += 1
        i += 3
    else:
        i += 1
print(count)

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

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

print(S.count('ABC'))

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

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

Solution (Python):
N=int(input())
S=input()
count=0
S=S.replace('ABC','1')
print(S.count('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):
import re
N = int(input())
S = str(input())
ans= re.findall('ABC',S)
print(len(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):
  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=int(input())
s=input()
tm=len(s.replace("ABC",""))
print((len(s)-tm)//3)

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

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

def res():
    ct=0
    for i in range(n):
        if i+2 > n-1:
            return ct
        if s[i] =="A"and s[i+1]=="B" and s[i+2]=="C":
            ct+=1

print(res())

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



if __name__ == '__main__':
    main()

Solution (Python):

import sys


def solve(N: int, S: str):
    cnt = 0
    for x in range(N-2):
        if S[x:x+3] == "ABC": cnt += 1
    print(cnt)
    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().count('ABC')
print(s)

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

s = input()
n = len(s)

count = 0

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

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

s = input()
n = len(s)

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",0,N))

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

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

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

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

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

print(s.count("ABC"))

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

print(S.count("ABC"))

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

print(ans)

Solution (Python):
import re

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

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

Solution (Python):
N = int(input())
S = str(input().split())
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):
    if s[i]=="A":
        if i+1<n and s[i+1]=="B":
            if i+2<n 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()
a = S.replace("ABC","")
print((len(S) - len(a))//3)

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

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

print(count)

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

print(S.count("ABC"))

Solution (Python):
n=int(input())
s=input()
ans = 0
while("ABC" in s):
    s = s.replace("ABC","",1)
    ans+=1
print(ans)

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

Solution (Python):
from sys import stdin
import math

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

print(s.count('ABC'))

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

N = int(input())
S = input().rstrip('\r\n')
ans = 0
for i in range(N-2):
    if S[i] == 'A' and S[i+1] == 'B' and S[i+2] == 'C':
       ans += 1
print(ans)

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

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

print(S.count('ABC'))

Solution (Python):
import sys
from collections import defaultdict

def load(vtype=int):
    return vtype(input().strip())

def load_list(seplator=" ", vtype=int):
    return [vtype(v) for v in input().strip().split(seplator)]

def exit():
    import sys
    sys.exit(0)

def check(s, i, j):
    if s[i:j+1] == 'ABC':
        return True
    return False

n = load()
s = load(str)

result = 0
for i in range(0, len(s)):
    if check(s, i, i+2):
        result += 1

print(result)

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

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

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

i = -1
c = 0

while True:
	i = s.find('ABC', i + 1)
	if i == -1:
		break
	c += 1
print(c)

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

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

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

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

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):
    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()
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=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()
ans=0
a=0
b=0
c=0
for i in S:
	if i=='A':
		a=1
		b=c=0
	elif i=='B' and a==1:
		if b==0:
			b=1
		else:
			a=0
			b=0
	elif i=='C' and a==1 and b==1:
		c=1
		ans+=c
		a=b=c=0
	else:
		a=b=c=0
print(ans)

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

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

Solution (Python):
input()
a=input()
b=0
for i in range(len(a)-2):
  b+=a[i]+a[i+1]+a[i+2]=='ABC'
print(b)

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

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


print(ans)

Solution (Python):
n = input()
s = input()
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() ; c = 0

for i in range(n-2):
    a = s[i:i+3]

    if a == 'ABC':
        c += 1
print(c)

Solution (Python):
N = int(input())
S = input()
S = [i for i in S]
cnt = 0

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

print(cnt)

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

print(S.count('ABC'))

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

Solution (Python):
import sys

input = sys.stdin.readline


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


def read_list():
    return list(read_values())


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

print(s.count('ABC'))

Solution (Python):
n = int(input())
s = input()
s_abc = "ABC"
count = 0
for i in range(n-2):
    for j in range(3):
        if s[i+j] != s_abc[j]:
            break
    else:
        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 i in range(0, n-2):
    if s[i : i + 3] == 'ABC':
        count += 1

print(count)

Solution (Python):
n, s = map(str, open(0).read().split())

print(s.count("ABC"))

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

print(s.count("ABC"))

Solution (Python):
N=int(input())
S=input()
pos=0
cnt=0
while pos >= 0:
    if S.find('ABC',pos) != -1:
        pos = S.find('ABC',pos) + 2
        cnt += 1
    else:
        pos = -1
print(cnt)

Solution (Python):
abc = 'ABC'

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

print(s.count(abc))

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

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

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


if __name__ == "__main__":
    main()

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

print(solve())

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

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

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

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

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

Solution (Python):

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

if __name__ == '__main__':
    main()

Solution (Python):



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

count = 0

for i, s in enumerate(S[:-2]):
    if s != 'A':
        continue
    else:
        if N >= i + 2 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()

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()
p = 0
cnt = 0
p = S.find('ABC', p)
while p != -1:
  cnt += 1
  p = S.find('ABC', p + 3)
print(cnt)

Solution (Python):
N = int(input())
S = input()
i = 0
ans = 0
while i < N-2:
    if S[i] == 'A' and S[i + 1] == 'B' and S[i + 2] == 'C':
        ans += 1
    i += 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()
string = 'ABC'
ans = 0
for i in range(N - 2):
    if S[i:i+len(string)] == string:
        ans += 1
print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N = int(input())
S = input().rstrip()

print(S.count('ABC'))

Solution (Python):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  

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

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

print(s.count('ABC'))

Solution (Python):
import re

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

x = re.sub(r'ABC', 'o', s)

print(x.count('o'))

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

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

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

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