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

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

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

Solution (Python):
N = int(input())
S_str = input()
counter = 0
for i in range(N):
    if S_str[i:i+3].startswith('ABC'):
        counter += 1
print(counter)

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

cnt = 0
while 1:
    idx = S.find('ABC')
    if idx==-1:
        break
    else:
        cnt += 1
        S = S[idx+3:]

print(cnt)

Solution (Python):
import sys

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

print(s.count("ABC"))

Solution (Python):

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

import re

print(len(re.findall("ABC", S)))

Solution (Python):
if __name__ == "__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)

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




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

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

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

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

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

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

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

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

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

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

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

cnt = 0

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

print(cnt)

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

Solution (Python):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from itertools import permutations, accumulate
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
import sys
def I(): return int(input())  
def Is(): return map(int, input().split())  
def LI(): return list(map(int, input().split()))  
def TI(): return tuple(map(int, input().split()))  
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()  
def LS(): return list(input())  
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(1000000)
MOD = 1000000007
INF = float('inf')

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

print(ans)

Solution (Python):

N = input()
S = input()

print(S.count("ABC"))

Solution (Python):


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

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

Solution (Python):
def num_of_ABC(str):
    number = str.count("ABC")
    return number

if __name__ == "__main__":
    _ = input()
    sentence = input()
    num = num_of_ABC(sentence)
    print(num)

Solution (Python):
N = int(input())
S = str(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()
count=0
i=0
while i<=n-3:
    if s[i]=="A":
        if s[i+1]=="B" and s[i+2]=="C":
            count+=1
            i+=3
        else: i+=1
    else: i+=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=count+1
print(count)

Solution (Python):
n = int(input())
s = [i for i in input()]
count = 0
total = 0
for p in s:
  if p == "A":
    count = 1
  elif count == 1 and p == "B":
    count = 2
  elif count == 2 and p == "C":
    count = 0
    total += 1
  else:
    count = 0
print(total)

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

ans = 0

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

print(ans)

Solution (Python):
N = int(input())
s = list(input())
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
j=0
for i in s:
    if i=="A":
        j=1
        continue
    if i=="B" and j==1:
        j=2
    elif i=="C" and j==2:
        ans+=1
        j=0
    else:
        j=0
print(ans)

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

import re

print(len(re.findall("ABC", S)))

Solution (Python):
def main():
    n = int(input())
    s = input()
    r = 0
    for i1 in range(0,n-2):
        r += s[i1:i1+3] == 'ABC'
    print(r)

if __name__ == '__main__':
    main()

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()
sx = s.split("ABC")

print(len(sx)-1)

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

print(S.count('ABC'))

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

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

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

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

print(ans)

Solution (Python):
n=int(input())
s=input()
l=[]
for i in s:
    l.append(i)

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

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()
S += 'a'
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 = 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):
  subs = S[i:i+3]

  if(subs == "ABC"):
    ans += 1


print(ans)

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

print(count)

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

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

Solution (Python):
a = 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()
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()
cnt=0
for i in range(0,N-2):
    if S[i:i+3]=='ABC':
        cnt+=1
    else:
        continue
print(cnt)

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

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

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

print(s.count("ABC"))

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

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

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

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

print(count)

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

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

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

print(s.count('ABC'))

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

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

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

print(solve())

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

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

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

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

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

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

print (S.count("ABC"))

Solution (Python):

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

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 = 0

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

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

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

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

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


if __name__ == "__main__":
    main()

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

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

print(count)

Solution (Python):


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

print(s.count("ABC"))

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

Solution (Python):
num=int(input())
moji=input()
print(moji.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())
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+"kk"
count=0
for i in range(0,n):
  if s[i:i+3]=="ABC":
    count+=1
print(count)

Solution (Python):

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

index = -1
current_index = -1
counter = 0
for i in range(n):
  if 'ABC' in s[i:]:
    current_index = s.index('ABC', i)
    
  if index != current_index:
    counter += 1
    index = current_index
print(counter)

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

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

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

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

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

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

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

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

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

    print(s.count("ABC"))


main()

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

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

if __name__ == '__main__':
    main()

Solution (Python):
x = int(input())
y = input()

print(y.count('ABC'))

Solution (Python):


def main():
    N, S = map(str, open(0).read().split())
    print(S.count('ABC'))


main()

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

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

print(count)

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

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

print(count)

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

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

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

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

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

print(ans)

Solution (Python):
n,s = int(input()),input()
count = 0
for x in range(n):
    if s[x:x+3] == "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):
def main():
  N=int(input())
  S=input()
  scount=0
  for i in range(N-1):
    for j in range(N):
      S_i=S[i:j+1]
      if(S_i=='ABC'):
        scount=scount+1
  print(scount)
  
if __name__=='__main__':
  main()

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

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

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

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

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

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

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

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

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

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

print(S.count('ABC'))

Solution (Python):
import sys
n = int(sys.stdin.readline())
s = sys.stdin.readline().strip()
print(s.count('ABC'))

Solution (Python):
import sys
n = int(sys.stdin.readline())
s = sys.stdin.readline().strip()
i = 0
cnt = 0
while i <= n -3:
  if s[i:i+3] == 'ABC':
    cnt += 1
  i += 1
print(cnt)

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

count = 0
x = n - 2
for i in range(x):
    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()

c = 0

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

print(c)

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

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

print(s.count("ABC"))

Solution (Python):
N = input()
S = input()
a = "ABC"

print(S.count(a))

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

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

count = 0

for i in range(N-2):
    letter1 = S[i]
    letter2 = S[i+1]
    letter3 = S[i+2]

    if (letter1 == 'A') and (letter2 == 'B') and (letter3 == 'C'):
        count += 1

print(count)

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

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

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

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

cnt = s.count("ABC")

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

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

print(count)

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

ans = 0;

for i in range(n):
  three = s[i:i+3];
  ans += int(three == "ABC");

print(ans);

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

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

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

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

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

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

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

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

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

Solution (Python):
import math
from functools import reduce
import itertools
import numpy as np

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

if __name__ == "__main__":
    solve()

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

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

print(count)

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

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

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

A = 0

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

Solution (Python):
import sys
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7


N = ri()
S = rs()

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

Solution (Python):
N = int(input())
S = str(input())
ans = 0
if N == 3:
  if S == 'ABC':
    ans += 1
else:
  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())
m = str(input())
a = m.count('ABC')
print(a)

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

print(cut)

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

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

Solution (Python):

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

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

import re

a = re.findall('ABC', S)
print(len(a))

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

Solution (Python):

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

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

ans = S.count('ABC') 

print(ans)

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

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

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

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

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

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

Solution (Python):


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

A_list = [i for i, x in enumerate(S) if x == 'A']
A_num = len(A_list)

k = 0
for j in range(A_num):
  if(A_list[j] < N-2):
    pp = A_list[j]
    if(S[pp+1]=="B" and S[pp+2]=="C"):
      k = k + 1
    else:
      pass
  else:
    pass

print(k)

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):
from collections import deque, Counter as cnt
from collections import defaultdict as dd
from operator import itemgetter as ig
from bisect import bisect_right as bsr
from math import factorial, ceil, floor
import sys
sys.setrecursionlimit(1000000)


args = None
INF = float("inf")
MOD = int(1e9 + 7)


def input(*ps):
    if type(ps[0]) is list:
        return [input(*ps[0][:-1]) for _ in range(ps[0][-1])]
    elif len(ps) == 1:
        return ps[0](next(args))
    else:
        return [p(next(args)) for p in ps]


def nlist(n, v):
    if not n:
        return [] if type(v) is list else v
    return [nlist(n[1:], v) for _ in range(n[0])]


def yesno(v, yes="Yes", no="No", upper=False):
    if upper:
        print([yes.upper(), no.upper()][not v])
    else:
        print([yes, no][not v])


def main():
    """エントリーポイント"""
    N, S = input(int, str)
    ans = 0
    for x in range(N - 2):
        if S[x:x + 3] == "ABC":
            ans += 1
    print(ans)


if __name__ == '__main__':
    args = iter(sys.stdin.read().split())
    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=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()
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):
N = int(input())
S = list(input())
ans = 0
for i in range(len(S)-2):
    if(S[i]=="A"):
        if(S[i+1]=="B"):
            if(S[i+2]=="C"):
                ans += 1

print(ans)

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

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

Solution (Python):

import sys


def solve(N: int, S: str):
    result = 0
    for i in range(N - 2):
        if S[i : i + 3] == "ABC":
            result += 1

    print(result)

    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  
    S = next(tokens)  
    solve(N, S)


if __name__ == "__main__":
    main()

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

print(s.count('ABC'))

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

Solution (Python):
icase=150
if icase==150:
    n=int(input())
    s=input()
    icnt=0
    for i in range(n-2):

        if s[i:i+3]=="ABC":
            icnt+=1
    print(icnt)

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

count = 0

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

print(count)

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

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

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

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

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

Solution (Python):
import math

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

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

print(ans)

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


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

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

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

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

ans = 0

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

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

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

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

print(S.count("ABC"))