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



Sample input:
10
ZABCDBABCQ


Sample output:
2

Submission status: Runtime Error

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

A_index = [i for i, x in enumerate(s) if x == 'A']

count = 0
for j in range(A_index[0], n-1) :
  if s[j+1] == 'B' :
    if s[j+2] == 'C' :
      count += 1

print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
S = [c  for c in input()]

count = 0

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

print(count)

Submission status: Runtime Error

Solution code:
N = int(input())
S = input()
count = 0
list(S)

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

print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
length = int(input())
string = input()
count=0

for i in range(0,length):
    if ("A" == string[i]) and ("B" == string[i+1]) and ("C" == string[i+2]) and i>length-2:
        count+=1
        i+=3

print(count)

Submission status: Runtime Error

Solution code:
n=int(input())
s=list(input())
c=0
for i in range(len(s)):
    if s[i] == "A":
        if s[i+1]=="B":
                try:
                    if s[i+2]=="C":
                        c+=1
                except:
                    pass
            
print(c)

Submission status: Runtime Error

Solution code:
def checkABC(S):
    count = 0
    for i in range(len(S)):
        if S[i] == 'A':
            if S[i+1] == 'B':
                if S[i+2] == 'C':
                    count += 1
    
    return count


N = int(input())

S = list(input())

print(checkABC(S))

Submission status: Runtime Error

Solution code:
import itertools
import math
N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
L = list(map(list,list(itertools.permutations(list(i for i in range(1,N+1)),N))))
a = L.index(P)
b = L.index(Q)
print(abs(a-b))

Submission status: Runtime Error

Solution code:
num = int(input())
a= input()
words = a.split()
ss = 0

for i in range(num):
  if "A" = words[i]:
    for q in range(i,num):
      if "B" = words[q]:
        for g in range(q,num):
          if "C" = words[g]:
            ss += 1

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
length = int(input())
string = input()
count=0

for i in range(0,length):
    if ("A" == string[i]) and ("B" == string[i+1]) and ("C" == string[i+2]):
        count+=1
        i+=3

print(count)

Submission status: Runtime Error

Solution code:
N=int(input())
s=input()
S=list(s)
#print(S[0])
flg=0
for i in range(N):
    if S[i] == 'A':
        if S[i+1] =='B':
            if S[i+2] =='C':
                flg+=1
print(flg)

Submission status: Runtime Error

Solution code:
N = int(input())
List = input()
List = list(List)

a = 0

for n in range(N):
  if List[n] == 'A':
    if List[n + 1] == 'B':
      if List[n + 2] == 'C':
        a += 1
        
print(a)

Submission status: Runtime Error

Solution code:
#ABC144 B
N=int(input())
S=input()
#print(N)
result=0

for i in range(N-1):
    if S[i]=="A" and S[i+1]=="B" and S[i+2]=="C":
        print(i)
        result+=1
    else:
        print("after"+str(i))
        p=1

print(result)

Submission status: Runtime Error

Solution code:
n=int(input())
s = list(input())
c=0
for i in range(len(s)):
    if s[i] == "A":
        if s[i+1]=="B":
               if s[i+2]=="C":
                    c+=1
               
            
print(c)

Submission status: Runtime Error

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

cnt = 0

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


print(cnt)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a=int(input())
b=list(input())
c=0
for i in range(a):
  if b[i]='A':
  else:
    pass
    if b[i+1]='B':
    else:
      pass
      if b[i+2]='C':
        c+=1
      else:
        pass
  
print(c)

Submission status: Runtime Error

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

cnt = 0

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


print(cnt)

Submission status: Runtime Error

Solution code:
cnt=0
for i in range(0,N//3+1,3):
  if S[i:i+3] == "ABC":
    cnt += 1
print(cnt)

Submission status: Runtime Error

Solution code:
a=int(input())
b=list(input())
c=0
for i in range(a):
  if b[i]='A':
    if b[i+1]='B':
    else:
      pass
      if b[i+2]='C':
        c+=1
      else:
        pass
  else:
  pass
print(c)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
s = list(input())
 
result = 0
for range(len(s)):
  if s > n - 3:
    break
  if (s[i] == 'A' and s[i+1] == 'B' and s[i+2] == 'C'):
    result = result + 1
    
print(result)

Submission status: Runtime Error

Solution code:
#ABC144 B
N=int(input())
S=input()
#print(N)
result=0

for i in range(N):
    if S[i]=="A" and S[i+1]=="B" and S[i+2]=="C":
        #print(i)
        result+=1
    else:
        #print("after"+str(i))
        p=1

print(result)

Submission status: Runtime Error

Solution code:
n = input('')
n = int(n)
s = input('')

count = 0
i = 0
while(n>i):
    if s[i]=='A':
        i+=1
        if s[i]=='B':
            i+=1
            if s[i]=='C':
                count+=1
                i+=1
    i+=1
print(count)

Submission status: Runtime Error

Solution code:
s = str(input())
n = int(input())
s.upper()
print(s.count('ABC')) if len(s)==n

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = input()
s = list(input())

A_index = [i for i, x in enumerate(s) if x == 'A']

count = 0
for j in A_index :
  if s[j+1] == 'B' :
    if s[j+2] == 'C' :
      count += 1

print(count)

Submission status: Runtime Error

Solution code:
n = int(input())
s = str(input())
count = 0
for i in range(n):
    if s[i] == 'a' or s[i] == 'A':
        if i + 1 <= n:
            if s[i + 1] == 'b' or s[i + 1] == 'B':
                if i + 2 <= n:
                    if s[i + 2] == 'c' or s[i + 2] ==  'C':
                        count += 1
print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a=int(input())
b=list(input())
c=0
for i in range(a):
  if b[i]="A":
    if b[i+1]="B":
    else:
      pass
      if b[i+2]="C":
        c+=1
      else:
        pass
else:
  pass
print(c)

Submission status: Runtime Error

Solution code:
s = str(input())
n = int(input())
print(s.count('ABC')) if len(s)==n

Submission status: Runtime Error

Solution code:
n = int(input())
s = str(input())
count = 0
for i in range(n):
    if s[i] == 'a' or s[i] == 'A':
        if s[i + 1] == 'b' or s[i + 1] == 'B':
            if s[i + 2] == 'c' or s[i + 2] ==  'C':
                count += 1
print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = input()
S = input()
c = 0
for i in range(len(S)):
  if S[i] == 'A' and S[i + 1] == 'B' and S[i+2] == 'C':
    c += 1
print(c)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s, n = input().split()
print(s.count('ABC'))

Submission status: Runtime Error

Solution code:
input()
s = input()

check = ['A', 'B', 'C']

count = 0
state = 0
for c in list(s):
	if c != check[state]:
      state = 0
      continue
    
    state += 1
    if state >= len(check):
      count += 1
      state = 0

print(count)

Submission status: Runtime Error

Solution code:
N,S=input()
print(S.count("abc"))

Submission status: Runtime Error

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

Slist = list(S)

count = 0

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


print(count)

#print('N = ', N)
#print('S = ', S)
#print('Slist = ', Slist)

Submission status: Runtime Error

Solution code:
inputA= int(input())
inputB =map(str,input().split())

print(inputB.count('ABC'))

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
s = list(input())

result = 0
for(int i = 0; i < n - 3; i++):
  if (s[i] == 'A' and s[i+1] == 'B' and s[i+2] == 'C'):
    result = result + 1
    
print(result)

Submission status: Runtime Error

Solution code:
inputA= int(input())
inputB =map(str,input())

print(inputB.count('ABC'))

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
N=int(input())
S=input()
ans=0
for s in S:
    
    if s=="A":
        c=1
    elif s=="B" and c==1:
        c=2
    elif s=="C" and c==2:
        ans+=1
        c=0
    else:
        c=0

print(ans)

Submission status: Runtime Error

Solution code:
n=int(input())
s=input()
c=0
for i in range(len(s)):
    if s[i]=="A":
        if s[i+1]=="B":
            if s[i+2]=="C":
                c+=1
                i+=2

print(c)

Submission status: Runtime Error

Solution code:
n = int(input())
s = str(input())
count = 0
for i in range(0,len(s)):
    if s[i] == "A":
        if i+2 <= len(s):
            if s[i+1] == "B" and s[i+2] == "C":
                count += 1
print (count)

Submission status: Runtime Error

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

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

print(count)

Submission status: Runtime Error

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

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

print(count)

Submission status: Runtime Error

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

dfs = df[S]

dfs.str.contains("ABC")

Submission status: Runtime Error

Solution code:
from collections import defaultdict, deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys
import random
import itertools
import math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt


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


def LF(): return list(map(float, input().split()))


def LI_(): return list(map(lambda x: int(x)-1, input().split()))


def II(): return int(input())


def IF(): return float(input())


def LS(): return list(map(list, input().split()))


def S(): return list(input().rstrip())


def IR(n): return [II() for _ in range(n)]


def LIR(n): return [LI() for _ in range(n)]


def FR(n): return [IF() for _ in range(n)]


def LFR(n): return [LI() for _ in range(n)]


def LIR_(n): return [LI_() for _ in range(n)]


def SR(n): return [S() for _ in range(n)]


def LSR(n): return [LS() for _ in range(n)]


def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)


def my_index_multi(l, x):
    return [i for i, _x in enumerate(l) if _x == x]


def sosu(x):
    for i in range(2, int(sqrt(x)+1)):
        if x % i == 0:
            return False
    return True


mod = 1000000007
inf = float('INF')


def A():
    K, X= LI()

    if (500*K>=X):
        print('Yes')
    else:
        print('No')


    return

# B


def B():
    N=II()
    S=input().rstrip()
    ans=0
    for i in S:
        if i=="A":
            t=1
            continue
        if i=="B" and t==1:
            t=2
            continue
        if i=="C" and t==2:
            t=0
            ans+=1
            continue
        t=0
    print(ans)



    return

# C


def true():
    S = input()
    S = S[:-1]

    tmp = 0
    for x in range(1 << (len(S)-1)):
        func = S[-1]
        for i in range(len(S)-1):
            if(x & (1 << i)):
                tmp += int(func)
                func = S[-2-i]
            else:
                func = S[-2-i]+func
        tmp += int(func)
    print(tmp)

    return


def flagcounter(x):
    if (x == 0):
        return 0
    return flagcounter(x >> 1)+(x & 1)


def C():
    X = II()
    if X == 2:
        print(2)
        return
    while(1):
        if sosu(X):
            print(X)
            return
        X += 1

    return


# D
def D():
    N, K = LI()
    R, S, P = LI()
    T=list(input().rstrip())
    ans = 0
    for j in range(K):
        if T[j] == 'r':
            ans += P
        if T[j] == 'p':
            ans += S
        if T[j] == 's':
            ans += R
    j = 0
    rps=['r','p','s']

    for i in range(K, N):
        if T[j] == T[i]:
            if i+K>=N:
                j += 1
                continue
            T[i]=rps[rps.index(T[i+K])-1]
            j += 1
            continue
        if T[i] == 'r':
            ans += P
        if T[i] == 'p':
            ans += S
        if T[i] == 's':
            ans += R
        j += 1
    print(ans)
    return


def Dsyakutori():

    N, K = LI()
    A = LI()
    MAX = sum(A)
    if MAX < K:
        print(0)
        return
    Temp = MAX
    ans = 1
    for i in range(N):
        Temp = Temp-A[i]
        if (Temp >= K):
            ans += 1
        else:
            T = Temp+A[i]
            break
    Temp = T
    ckeep = N
    for k in range(N):
        c = N-1
        i -= 1
        Temp = T

        for j in range(N):
            Temp = Temp-A[c]
            if (Temp >= K):
                ans += 1

            elif(c < ckeep and i >= 0):
                ans += i
                ckeep = c
                break
            else:
                ckeep = c
                break
            c -= 1
        if i < 0:
            break
        T = T+A[i]
    print(ans)

    return

# E


def E():
    N, M= LI()
    A = LI()
    A.sort(reverse=True)
    B=[0]*(N+1)
    for i in range(1,N+1):
        B[i]=B[i-1]+A[i-1]
    D=[0]*(2*10**5+1)
    for i in range(N):
        D[A[i]]+=1
    for i in range(len(D)-1,0,-1):
        D[i-1]+=D[i]
    l=-1
    r=2*10**5+1
    while r-l>1:
        m=(l+r)//2
        s=0
        for i in range(N):
            s+=D[max(1,m-A[i])]
        if s>=M:
            l=m
        else:
            r=m
    ans=0
    s=0
    for i in range(N):
        v=max(0,r-A[i])
        t=max(0,min(D[v],M-s))
        ans+=B[t]+t*A[i]
        s+=t
    ans+=l*(M-s)
    print(ans)

    
    return

# F


def F():
    N, M = LI()

    value = [0] * M
    power = [0] * M
    for i in range(M):
        a, b = LI()
        value[i] = a
        c = LI()
        L = ['0'] * N
        for k in c:
            L[k - 1] = '1'
        bint = ''.join(L)
        power[i] = int(bint, 2)
    bint = ''.join(list(['1'] * N))
    dp = [inf] * (int(bint, 2)+1)
    t = 0
    cost = 0

    dp[0] = 0
    for s in range(int(bint, 2) + 1):
        for i in range(M):
            t = s | power[i]
            cost = dp[s] + value[i]
            dp[t] = min(dp[t], cost)
    print(-1) if(dp[-1] == inf) else print(dp[-1])

    return

    # you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")


def solution(S):
    # write your code in Python 3.6
    N = len(S)

    pass


# Solve
if __name__ == '__main__':

    B()

Submission status: Runtime Error

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

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

print(count)

Submission status: Runtime Error

Solution code:
s = input().split()[1]
print(s.count("ABC"))

Submission status: Runtime Error

Solution code:
n = int(input())
s = str(input())
count = 0
for i in range(n):
    if s[i] == 'a' or 'A':
        if s[i + 1] == 'b' or 'B':
            if s[i + 2] == 'c' or 'C':
                count += 1
print(count)

Submission status: Runtime Error

Solution code:
inputA= int(input())
inputB =map(input())

print(inputB.count('ABC'))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys,queue,copy
sys.setrecursionlimit(10**8)
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
INF = float('inf')


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

ans = 0
i = 0
while i < N:
    if S[i] == "A":
        i += 1
        if S[i] == "B":
            i += 1
            if S[i] == "C":
                ans += 1
                i+=1
            else:
                continue
        else:
            continue
    else:
        i += 1
        continue


print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n,s = input().split()
print(s.count('ABC'))

Submission status: Runtime Error

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

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

print(count)

Submission status: Runtime Error

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

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

print(cnt)

Submission status: Runtime Error

Solution code:
inputA,inputB =map(input())

print(inputB.count('ABC'))

Submission status: Runtime Error

Solution code:
N = int(input())
S = input()
temp = 0
count = 0
while S < N:
    if S[temp] == A:
        if S[temp:temp+3] == "ABC":
            count += 1
            temp += 3
        else:
            temp += 3
    else:
        temp += 1
print(count)

Submission status: Runtime Error

Solution code:
s = input().split()[1]
s.count("ABC")

Submission status: Runtime Error

Solution code:
ans=0
n=input()
s=input()


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

Submission status: Runtime Error

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

i = 0
ans = 0

while i < len(s):
    if s[i] == "A" and s[i + 1] == "B" and s[i + 2] == "C":
        ans += 1
        i += 3
    else:
        i += 1
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

print(count)

Submission status: Runtime Error

Solution code:
n = int(input())
s = input()
res = 0

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

print(res)

Submission status: Runtime Error

Solution code:
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
print(cnt)

Submission status: Runtime Error

Solution code:
n,s = map(str,input().split())

print(s.count('ABC'))

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
n = int(input())
table = list(input())
cnt = 0
for x in range(n):
    if table[x] == 'A' and table[x + 1] == 'B' and table[x + 2] == 'C':
        cnt += 1
print(cnt)

Submission status: Runtime Error

Solution code:
n = int(input())
s = input()
count = 0
for i in range(n):
    if s[i]!="A":
        pass
    else:
        if s[i+1]!="B":
            pass
        else:
            if s[i+2]!="C":
                pass
            else:
                count += 1
print(count)

Submission status: Runtime Error

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

i = 0
ans = 0
while i <= n-2:
    if s[i] == "A" and s[i+1] == "B" and s[i+2] == "C":
        ans += 1
        i += 3
    else:
        i += 1

print(ans)

Submission status: Runtime Error

Solution code:
C010_scrambled

Submission status: Runtime Error

Solution code:
n = int(input())
s = str(input())
a = 0
for i in range(0,n):
  if s[i] == "A":
    if s[i+1] == "B":
      if s[i+2] == "C":
        a +=1

print(a)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

ret = 0

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

print(ret)

Submission status: Runtime Error

Solution code:
n = int(input())
S=input()
c=0
for i in range(n):
    if S[i]=="A":
        if S[i+1]=="B":
            if S[i+2]=="C":
                c+=1
print(c)

Submission status: Runtime Error

Solution code:
https://atcoder.jp/contests/abc150/submitinput()
s = input()
ans = 0
while 1:
    pos = s.find('ABC')
    if pos == -1:
        break
    ans += 1
    s = s[pos + 3:]
print(ans)

Submission status: Runtime Error

Solution code:
from sys import stdin
stdin = open("input.txt")

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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