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):
import math
import fractions
import sys
import itertools
import numpy as np
from collections import Counter
import datetime

def input1():
	return int(input())


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


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

def keta(N):
	return len(str(N))


def input_daytime(input_time):
	time,distance=input_time.split()
	t=time.split(":")
	se=str(t[-1]).split(".")
	dt1 = datetime.timedelta(hours=int(t[0]),minutes=int(t[1]),seconds=int(se[0]),milliseconds=int(se[1]))
	return dt1

n=input1()
s=str(input())
count=0
print(s.count("ABC"))

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

print(count)

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

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

Solution (Python):


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

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

print(ans)

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

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

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

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

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

    
if __name__ == '__main__':
    q2()

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

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

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

Solution (Python):
import sys

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

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7


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

print(S.count("ABC"))

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

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

new_S = S.replace("ABC", "@")

print(new_S.count("@"))

Solution (Python):
n = int(input())
s = input()
ans = 0
for x,y,z in zip(s,s[1:],s[2:]):
    if x == 'A' and y == 'B' and z == 'C':
        ans += 1
print(ans)

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

ans = 0

i = 0
while i < n-2:
  if ss[i] == "A" and ss[i + 1] == "B" and ss[i + 2] == "C":
    ans += 1
  i += 1
    
print(ans)

Solution (Python):



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

    print(s.count("ABC"))


if __name__ == '__main__':
    main()

Solution (Python):
N=int(input())
A=list(input())
cnt=0

for n in range(N):
    if n==N-1 or n==N-2:
        continue
    elif A[n]=="A":
        if A[n+1]=="B":
            if A[n+2]=="C":
                cnt+=1
            else:
                continue
        else:
            continue
    else:
        continue

print(cnt)

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

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

print(count)

Solution (Python):


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

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

if __name__ == "__main__":
    main()

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

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


if __name__ == '__main__':
    main()

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

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 = str(input())
part = 'ABC'
count = 0
for i in range(n):
  if (part in s) == False:
    break
  s = s.replace(part, "", 1)
  count += 1  
print(count)

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

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

print(S.count('ABC'))

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

Solution (Python):
N = 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 collections
N = int(input())
S = input()

print(S.count("ABC"))

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

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

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
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()
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 = 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):
n = int(input())
s = input()

print(s.count('ABC'))

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

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

print(count)

Solution (Python):
import sys
import os
import math

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


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

    N = ii()
    S = iss()
    ret = 0
    print(sum((S[n:n+3] == 'ABC') for n in range(N-2)))


if __name__ == '__main__':
    main()

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

if __name__ == "__main__":
    main()

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

print(S.count('ABC'))

Solution (Python):

import sys
import numpy as np


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

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

Solution (Python):

if False:
    K,X=map(int,input().split())
    print('Yes' if 500*K>=X else 'No')


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

Solution (Python):
import math

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

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

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

i = s.find('ABC',0)
while i >= 0:
    i = s.find('ABC',i + 3)
    c += 1

print(c)

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

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

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

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

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

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

Solution (Python):
import sys


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


if __name__ == '__main__':
    solve()

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

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

print(res)

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

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

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

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(len(s.split('ABC'))-1)

Solution (Python):
import re

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

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

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

match_word = 'ABC'
bool_count = 0
for i in range(0, N - 2):
    if ''.join(string_data[i:i+3]) == match_word:
        bool_count += 1

print(bool_count)

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

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

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

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

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

Solution (Python):
import sys
import os
import math

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


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

    N = ii()
    S = iss()
    print(S.count('ABC'))


if __name__ == '__main__':
    main()

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

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

print(len(list(re.finditer('ABC',S))))

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

Solution (Python):
l=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]+S[i+1]+S[i+2] == 'ABC':
        cnt += 1
print(cnt)

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

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


print(cnt)

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()
index=0
ans=0
while 1:
  if s.find('ABC',index)!=-1:
    index=s.find('ABC',index)+1
    ans+=1
  else:
    break
    
print(ans)

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

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 st in range(n - 2):
    abc = s[st:st+3]
    if abc == "ABC":
        cnt += 1
        st += 2
    else:
        pass
print(cnt)

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

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

Solution (Python):
from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
from fractions import gcd
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
EPS = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

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

print(sum([int(bool(S[i:i+3]=='ABC')) for i in range(0,N-2)]))

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

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

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

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

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

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

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

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

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

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

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

print(count)

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

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

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

Solution (Python):
N = int(input())
S = list(map(str, input()))

count = 0
for i in range(N - 2):
    cha = "".join(S[i:i + 3])
    
    if cha == "ABC":
        count += 1
    else:
        continue

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



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

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

k = 0

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

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

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

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

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

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

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

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

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(0,n-2):
  tmp = s[i:i+3]
  if tmp == 'ABC': cnt += 1
print(cnt)

Solution (Python):

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

Solution (Python):

import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

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

Solution (Python):

import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

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

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

Solution (Python):
N = input()

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

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

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

print(i)

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

count = S.count('ABC')

print(count)

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

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

print(cnt)

Solution (Python):
s_length=int(input())
S=input()
count=0
for i in range(len(S)-2):
    if S[i]+S[i+1]+S[i+2]=='ABC':
        count+=1
    else:
        pass
print(count)

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

Solution (Python):
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]


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

    N = ii()
    S = iss()
    print(sum(S[n:n+3] == 'ABC' for n in range(N-2)))


if __name__ == '__main__':
    main()

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

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

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

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

Solution (Python):
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):
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n=INT()
    s=STR()
    ct=0
    for i in range(n-2):
        if s[i:i+3]=='ABC':
            ct+=1
    print(ct)
            
if __name__ == '__main__':
    do()

Solution (Python):
a = int(input())
b = input()
count=0
for i in range(len(b)):
    if b[i:i+3] == 'ABC':
        count += 1

print(count)

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

Solution (Python):










"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""
  
def main():
  n = int(input())
  s = input()
  
  cnt = 0
  for i in range(1,n-1):
    if s[i] == 'B':
      if s[i-1] == 'A' and s[i+1] == 'C':
        cnt += 1
  print(cnt)
if __name__ == '__main__':
  main()

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

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

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

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

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

print(S.count('ABC'))

Solution (Python):


import sys














def main():
    mod = 10000007                  
    inf = float('inf')
    input = sys.stdin.readline      
    sys.setrecursionlimit(10**6)    
    def ii():  return int(input())
    def mi():  return map(int, input().rstrip().split())
    def lmi(): return list(map(int, input().rstrip().split()))
    def li():  return list(input().rstrip())
    
    
    n = ii()
    s = input()
    ans = 0
    for i in range(n):
        if i+2 <= n-1 and 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()
"""
ABC_count = 0
for i in range(N-3):
    if S[i:i+3] =="ABC":
        ABC_count += 1
    
print(ABC_count)
"""
a=S.count("ABC")

print(a)

Solution (Python):
N=int(input())
s=list(map(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=list(map(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().rstrip()

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()
count =0
flg = 0
for s in S:
    if s == "A":
        flg = 1
    elif s == "B" and flg == 1:
        flg =2
    elif s =="C" and flg ==2 :
        count +=1
        flg =0
    else:
        flg = 0
print(count)

Solution (Python):





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

print(S.count("ABC"))

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

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

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

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
S = sr()
answer = S.count('ABC')
print(answer)

Solution (Python):
N,S=open(0);print(S.count('ABC'))

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

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

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
S = sr()
answer = 0
for x, y, z in zip(S, S[1:], S[2:]):
    if x + y + z == 'ABC':
        answer += 1
print(answer)

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

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

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 = str(input())
cnt = 0
if N <= 2:
    print(0)
else:
    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 = list(input())

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