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

from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip


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

    a = 0

    p1 = p2 = p3 = ''
    for c in s:
        p1 = p2
        p2 = p3
        p3 = c

        if p1 == 'A' and p2 == 'B' and p3 == 'C':
            a += 1

    print(a)




BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")



if __name__ == "__main__":
    main()

Solution (Python):
import sys
input = sys.stdin.readline
N=int(input())
S=input()
count = 0
for i in range(N-2):
    if S[i]+S[i+1]+S[i+2] == "A"+"B"+"C":
        count += 1
print(count)

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

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

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

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

Solution (Python):
s=list(map(int,input().split()))
t=input()
a=0
for i in range(s[0]-2):
  if t[i]=='A':
    if t[i+1]=='B':
      if t[i+2]=='C':
        a+=1
print(a)

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

if __name__ == "__main__":
    resolve()

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

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

Solution (Python):



def ri():
    return int(input())

def rl():
    return list(input().split())

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

def main():
    n = ri()
    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="D"+input()+"D"
t=s[:3]
p=0
for i in range(3,n+2):
    t=t[1:]+s[i]
    if t=="ABC":
        p+=1
print(p)

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

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

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

Solution (Python):
import sys, math
def input():
    return sys.stdin.readline()[:-1]
from itertools import permutations, combinations
from collections import defaultdict, Counter

sys.setrecursionlimit(10**7)
N = int(input())
S = input()

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

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

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

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

o=0

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

print(o)

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

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

Solution (Python):
N = int(input())
S = input()[0:N]
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=c+1
print(c)

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-2):
    if S[i:i+3]=="ABC":
        count+=1

print(count)

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

Solution (Python):
import re


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

res = 0

while True:
    if re.search('ABC', S):
        R = re.search('ABC', S)
        S = S[R.end():]
        res += 1
    else:
        break

print(res)

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

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

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

buf1 = ""
buf2 = ""
count = 0
for s in S:
    if s == "C" and buf2 == "B" and buf1 == "A":
        count += 1
    buf1 = buf2
    buf2 = s

print(count)

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

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

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

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

print ans

Solution (Python):

 
import math
import itertools
import sys
import copy
 







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

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

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

Solution (Python):
n = 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":
        if s[i+1] == "B":
            if s[i+2] == "C":
                cnt+=1
print(cnt)

Solution (Python):
input()
s = input()
ans = 0
while 1:
    pos = s.find('ABC')
    if pos == -1:
        break
    ans += 1
    s = s[pos + 3:]
print(ans)

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

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

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

frag = 0
count = 0
for i in range(n) :
    if s[i] == 'A':
        frag = 1
    elif s[i] == 'B' and frag == 1 :
        frag = 2
    elif s[i] == 'C' and frag == 2 :
        count += 1
        frag = 0
    else :
        frag = 0
print(count)

Solution (Python):

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))


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


    
main()

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

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

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

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

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

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

Solution (Python):

si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
n=ni()
s=si()
print(s.count('ABC'))

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

cnt=0

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

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

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

ans = 0
c = 0
for s in S:
    if s == 'A':
        c = 1
    elif s == 'B' and c == 1:
        c = 2
    elif s == 'C' and c == 2:
        c = 0
        ans += 1
    else:
        c = 0
print(ans)

Solution (Python):
n=int(input())
s=str(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 = str(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:i+3] == "ABC":
		cnt += 1

print(cnt)

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

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

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

print(count)

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

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

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

flag=0

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

Solution (Python):
from sys import stdin


if __name__ == "__main__":
  N = int(stdin.readline())
  S = stdin.readline().rstrip()
  
  print(S.count("ABC"))

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

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

cnt = 0
for e in zip(s, s[1:], s[2:]):
    if e == ("A", "B", "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 = list(input())
ans = 0
i = 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 = S.count('ABC')
print(ans)

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

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

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

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):
def examA():
    K, X = LI()
    if K*500>=X:
        ans = "Yes"
    else:
        ans = "No"
    print(ans)
    return

def examB():
    N = I()
    S = SI()
    ans = 0
    for i in range(N-2):
        if S[i:i+3]=="ABC":
            ans +=1
    print(ans)
    return

def examC():
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examB()

Solution (Python):
import sys
def input():
    return sys.stdin.readline()[:-1]
n=int(input())
s=input()
ans=0
for i in range(len(s)-2):
    if s[i]+s[i+1]+s[i+2]=="ABC":
        ans+=1
print(ans)

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

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

print(ans)

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

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

Solution (Python):
import collections as c
ip = lambda : map(int, input().split())

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):
import sys,math,string,bisect
input=sys.stdin.readline
from collections import deque,defaultdict
L=lambda : list(map(int,input().split()))
Ls=lambda : list(input().split())
M=lambda : map(int,input().split())
I=lambda :int(input())
S=lambda :input().strip()
k=I()
n=input()
print(n.count("ABC"))

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

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

print(ans)

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

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

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

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

print(S.count('ABC'))

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

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

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()

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

    
if __name__ == '__main__':
    main()

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

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

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

N = num()
S = input()
ans = 0
while S.find("ABC") != -1:
    S = S[S.find("ABC")+1:]
    ans += 1
print(ans)

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

print(S.count("ABC"))

Solution (Python):
n=int(input())
s=input()
ans = 0
for i in range(n-2):
  if s[i]=="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()
ans=0

for i in range(0,N-2):
    if S[i]=="A":
        if S[i+1]=="B":
            if S[i+2]=="C":
                ans+=1
print(ans)

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

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

Solution (Python):
A = input()
V = input()
print(V.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()[0:N]
print(S.count("ABC"))

Solution (Python):
import math
import bisect
import collections
import itertools
import heapq
import string
import sys
sys.setrecursionlimit(10**9)
def gcd(a,b):return math.gcd 
def lcm(a,b):return (a*b) // math.gcd(a,b) 
def iin(): return int(input()) 
def isn(): return input().split() 
def imn(): return map(int, input().split()) 
def iln(): return list(map(int, input().split())) 
def iln_s(): return sorted(iln()) 
def iln_r(): return sorted(iln(), reverse=True) 
def join(l, s=''): return s.join(l) 
def perm(l, n): return itertools.permutations(l, n) 
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) 
def comb(l, n): return itertools.combinations(l, n) 
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) 
def divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i: divisors.append(n//i)
    return divisors
def is_prime(n):
    if n == 1: return False
    for i in range(2, int(n**0.5) + 1):
        if n % i == 0: return False 
    return True
def primes(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n + 1, i): is_prime[j] = False
    return [i for i in range(n+1) if is_prime[i]]
def sieve_of_e(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n+1, i): is_prime[j] = False
    return is_prime

N = iin()
S = input()

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

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

print(x)

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

n = int(input())
s = input()
print(len(re.findall(r"ABC", s)))

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

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

Solution (Python):
n = int(input())
s = input()
ans = 0
for i in range(n-2):
  if s[i] == '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()
buf = 0

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

print(buf)

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):
    if S[i:i+3] == 'ABC':
        cnt += 1
print(cnt)

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

print(input().count("ABC"))

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

ct = 0
for a in range(len(S)-2):
    if S[a] == 'A' and S[a+1] == 'B' and S[a+2] == 'C':
        ct += 1

print(ct)

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

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

Solution (Python):

import sys


def solve(N: int, S: str):
    ans = 0
    for i in range(2, N):
        if S[i-2] == "A" and S[i-1] == "B" and S[i] == "C":
            ans += 1
    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 = list(input())
l = ["A","B","C"]
ans = 0
for i in range(n-2):
    if s[i:i+3] == l:
        ans += 1
print(ans)

Solution (Python):
import sys
def I(): return int(sys.stdin.readline())
def LI(): return [int(x) for x in sys.stdin.readline().split()]

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


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

print(count)

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

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

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

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

print(S.count('ABC'))

Solution (Python):
_, S = input(), 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(x) for x in input().split())
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()
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()

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

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

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

print(ans)

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

Solution (Python):
n = int(input())
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):
import sys
import math
import bisect
stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

n = ni()
s = ns()
c = 0
for i in range(n-2):
    if s[i] == "A":
        if s[i+1:i+3]=="BC":
            c += 1
print(c)

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

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

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

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

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

print(count)

Solution (Python):
n = int(input())
s = str(input())
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-2):
    if S[i:i+3] == 'ABC':
        count += 1
print(count)

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

def gcd(a: int, b: int):
    """ https://cocodrips.hateblo.jp/entry/2014/03/05/143623
    """
    while b:
        a, b = b, a%b
    return a

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


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


if __name__ == "__main__":
    main()

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

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

print(s)

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

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



if __name__ == "__main__":
    main()

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

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

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


if __name__ == '__main__':
    main()

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

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.replace('ABC', '-').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):
def main():
    import sys
    N=int(sys.stdin.readline())
    S=input()
    print(S.count('ABC'))
    

main()

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

print(s.count('ABC'))

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

print(cnt)

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

Solution (Python):
import math
import itertools
import fractions
import heapq
import collections
import bisect
import sys

sys.setrecursionlimit(10**9)
mod = 998244353
inf = 10**20

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

n = I()
s = S()

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

Solution (Python):

N = int(input())

S = input()

S += "  "
ans = 0

for i in range(N):

    if S[i] + S[i+1] + S[i+2] == "ABC":
        ans += 1

print (ans)

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

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