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

for p in range(len(s)):
  if p <= n - 3:
    if s[p] == 'A':
      if s[p + 1] == 'B' and s[p + 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 = input()

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

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

Solution (Python):
import re

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

result = re.findall(r'ABC', S)

print(len(result))

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

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

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

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

a_lst = ([i for i, x in enumerate(S) if x == 'A'])
count = 0
for j in a_lst:
    if len(S) >= j + 3:
        if S[j+1] == 'B' and S[j+2] == 'C':
            count += 1
print(count)

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

cnt = 0

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

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

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

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

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


if __name__ == "__main__":
    solve()

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

print(s.count("ABC"))

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

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

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

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

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

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

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

for i in range(len(S)):
    if i <= len(S)-3:
        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(n-2):
    if s[i] == 'A':
        if s[i+1] == 'B':
            if s[i+2] == 'C':
                cnt += 1

print(cnt)

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

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 = input()
print(len(input().split("ABC")) - 1)

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

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

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

print(s.count("ABC"))

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

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

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

print(ans)

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

if '__main__' == __name__:
    resolve()

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

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

print(s.count("ABC"))

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

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

print(count)

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

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

    ans = S.count('ABC')

    print(ans)


if __name__ == '__main__':
    main()

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

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

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

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

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

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

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

    if N != len(S):
        return

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

if __name__ == "__main__":
    solve()

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

main()

Solution (Python):
n=int(input())
s=input()
cnt=0
i=1
while(i<n-1):
    if(s[i-1]=='A' and s[i]=='B' and s[i+1]=='C'):
        cnt+=1
    i+=1
        
print(cnt)

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

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()
a = [str(c) for c in s]

c = 0

for i in range(n-2):
  if a[i] == 'A' and a[i+1] == 'B' and a[i+2] == 'C':
    c +=1
  else:
    continue
    
print(c)

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

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

Solution (Python):
n = int(input())
s = input()
cnt = s.replace('ABC', 'a').count('a')
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):
def solve():
    n = int(input())
    s = input()
    tmp = 0
    for i in range(n - 2):
        if (s[i], s[i+1], s[i+2]) == ("A", "B", "C"):
            tmp += 1
    print(tmp)
solve()

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()
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):
import os, sys, re, math

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

T = S.replace('ABC', '')
print((len(S) - len(T)) // 3)

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

Solution (Python):
import re

_ = input()
x = input()

print(len(re.findall(r"ABC", x)))

Solution (Python):






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

ans = 0

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

Solution (Python):






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

ans = 0
aDec = False
bDec = False

for i in range(n):
    if s[i] == "A":
        aDec = True
        bDec = False
    elif s[i] == "B":
        if (aDec):
            bDec = True
        else:
            bDec = False
        aDec = False
    elif s[i] == "C":
        if (bDec):
            ans += 1
        bDec = False
        aDec = False
    else:
        bDec = False
        aDec = False
print(ans)

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())
a=input()
b=[]

for i in range(n-2):
  b.append(a[i]+a[i+1]+a[i+2])
  
print(b.count('ABC'))

Solution (Python):
N=int(input())
S=str(input())
S=S.replace('ABC','')
if N==len(S):
  print(0)
else:
  print((N-len(S))//3)

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

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

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

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

print(ans)

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

print(S.count('ABC'))

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

Solution (Python):

















































global FLAG_LOG
FLAG_LOG = False


def log(value):
    
    
    if FLAG_LOG:
        print(str(value))


def calculation(lines):
    S = lines[1]
    N = int(lines[0])
    
    
    
    
    
    
    
    
    

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

    return [result]



def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines



def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['10', 'ZABCDBABCQ']
        lines_export = [2]
    if pattern == 2:
        lines_input = ['19', 'THREEONEFOURONEFIVE']
        lines_export = [0]
    if pattern == 3:
        lines_input = ['33', 'ABCCABCBABCCABACBCBBABCBCBCBCABCB']
        lines_export = [5]
    return lines_input, lines_export



def get_mode():
    import sys
    args = sys.argv
    global FLAG_LOG
    if len(args) == 1:
        mode = 0
        FLAG_LOG = False
    else:
        mode = int(args[1])
        FLAG_LOG = True
    return mode



def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(2)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    
    
    
    
    
    
    
    
    
    
    



if __name__ == '__main__':
    main()

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

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

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

Solution (Python):
_ = input()
a = list(input())
cnt = 0
word = 0
for i in a:
    if word == 0 and i == 'A':
        word = 1
    elif word == 1 and i =='B':
        word = 2
    elif word == 2 and i =='C':
        word = 0
        cnt += 1
    else:
        if i == 'A': 
            word = 1
        else:
            word = 0
print(cnt)

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

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


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

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

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

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

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

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

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

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

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

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

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

Solution (Python):
import sys
N = int(input())
S = input()
array_S = list(S)

if not ( 3 <= N <= 50 and S.isupper() ): sys.exit()

count = 0
for I in range(N-2):
    if ''.join(array_S[I:I+3]) == 'ABC':
        count += 1
print(count)

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

Solution (Python):
_ = input()
S = input()
newS = S.replace("ABC", "")
print((len(S) - len(newS)) // 3)

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

print(S.count('ABC'))

Solution (Python):
"""
全探索
先頭から3文字ずつで切っていき、"ABC"か判定し、区切りを1個後ろへずらす
"""
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().split("ABC")
print(len(S)-1)

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

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

Solution (Python):
input()
print(input().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()
flag=0
ans=0
for si in s:
    if si=='A':
        flag=1
    elif si=='B' and flag==1:
        flag=2
    elif si=='C' and flag==2:
        ans+=1
        flag=0
    else:
        flag=0
print(ans)

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

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

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

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

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

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

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

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

Solution (Python):
def abc_150b():
    n = input()
    s = input()
    cnt = 0

    
    cnt = s.count('ABC')

    
    
    

    print(cnt)

if __name__ == '__main__':
    abc_150b()

Solution (Python):
def abc_150b():
    n = input()
    s = input()
    cnt = 0

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

    print(cnt)

if __name__ == '__main__':
    abc_150b()

Solution (Python):










from sys import stdin
import numpy as np
import math

input = stdin.readline

def divisor(_n):
    result = []
    for i in range(1, int(math.sqrt(_n)) + 1):
        if _n % i == 0:
            result.append(i)
            if _n % (_n / i) == 0:
                result.append(int(_n / i))
    return result

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

ans = 0

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

print(ans)

Solution (Python):
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

n = i()
s = s()

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

print(cnt)

Solution (Python):
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

n = i()
s = s()
print(s.count("ABC"))

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

Solution (Python):
n = int(input())
s = input()
count = 0
for i in range(len(list(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()
s2 = s.replace("ABC","")
print(int((len(s)-len(s2))/3))

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):
  if S[i:i+3] == "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: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):
t=int(input())
n=input() 
print(n.count('ABC'))

Solution (Python):
def countABC(n, s):

    return s.count("ABC")

def main():
    n = int(input())
    s = str(input())
    print(countABC(n, s))

if __name__ == '__main__':
    main()

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

Solution (Python):

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

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

Solution (Python):


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

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

Solution (Python):
def main():
    N = int(input())
    S = list(input().rstrip())
    ans = 0
    for i in range(N-2):
        if S[i:i+3] == ["A", "B", "C"]:
            ans += 1
    print(ans)


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

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

print(S.count('ABC'))

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

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

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

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

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

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

Solution (Python):

from sys import stdin
input = stdin.readline

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()
count = 0
if N == 3:
  if S == 'ABC':
    count = 1
elif N > 3:
	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()
print(s.count('ABC'))

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

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

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

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

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


resolve()

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

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

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

print(s.count('ABC'))

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

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

Solution (Python):
import sys
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):
import sys
input = sys.stdin.readline

print((input() + input()).count('ABC'))

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

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

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

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

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

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

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

Solution (Python):
def main():
  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)
  
  
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()
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())
print(input().count("ABC"))

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

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

print(s.count("ABC"))

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

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

    if s[i]+s[i+1]+s[i+2] == "ABC":
        count = count+1

print(count)

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

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

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

print(S.count('ABC'))

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

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

count = 0
for i in range(0, 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()
count = 0

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

print(count)

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

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

print(count)

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

Solution (Python):
def main():
    N = int(input())
    S = input()
    total = 0
    for i in range(len(S) - 2):
        if S[i] + S[i + 1] + S[i + 2] == 'ABC':
            total += 1  
    print(total)
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 = input()
target = "ABC"
j = 0
count = 0
for i in range(N):
    if S[i] == target[0]:
        j = 0
    if S[i] == target[j]:
        j += 1
    else:
        j = 0
    if j == 3:
        count += 1
        j = 0
print(count)

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

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

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

count = 0
while len(s) > 2:
    if s[0] == "A" and s[1] =="B" and s[2] == "C":
        count += 1
        del s[0:2]
    else:
        del s[0]

print(count)

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

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

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

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

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
inf = 10**17
mod = 10**9+7

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

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

print(ans)

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

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

Solution (Python):
n=int(input())
s=input()
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())
count = 0
if n % 3 == 1 or n % 3 == 0:
  for i in range(n-1):
    if s[i] == 'A' and s[i+1] == 'B' and s[i+2] == 'C':
      count += 1
elif n % 3 == 2:
  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())
a = 0
if n % 3 == 1 or n % 3 == 0:
  for i in range(n-1):
    if s[i] == 'A' and s[i+1] == 'B' and s[i+2] == 'C':
      a += 1
elif n % 3 == 2:
  for i in range(n-2):
    if s[i] == 'A' and s[i+1] == 'B' and s[i+2] == 'C':
      a += 1
print(a)

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

Solution (Python):
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt
from copy import deepcopy


def main():
	count = 0
	num = int(input())
	strings = input()
	
	for i in range(0,num-2,1):
		if strings[i] == "A" and strings[i+1] == "B" and strings[i+2] == "C":	
			count += 1
	print(count)

if __name__ == '__main__':
	main()