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 = input()
c = 0
for i in range(2,n+1):
  if s[i-2] == "A" and s[i-1] == "B" and s[i] == "C":
    c += 1
print(c)

Submission status: Runtime Error

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

# print(S.count('ABC'))

cnt = 0
for i in range(N):
    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()

# print(S.count('ABC'))

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

print(cnt)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
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 + 2:
        if S[j+1] == 'B' and S[j+2] == 'C':
            count += 1
print(count)

Submission status: Runtime Error

Solution code:
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 S[j+1] == 'B' and S[j+2] == 'C':
        count += 1
print(count)

Submission status: Runtime Error

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


if __name__ == "__main__":
    solve()

Submission status: Runtime Error

Solution code:
n = int(intput())
str = input()
print(str.count('ABC'))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())

s = input()
a = [str(c) for c in s]

c = 0

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

Submission status: Runtime Error

Solution code:
N=int(input())
S=str(input())
S=S.remove('ABC')
if N==len(S):
  return 0
else:
  return (N-len(S))//3

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

print(s.count("ABC")

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

for i in range(0, N-1):
    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()

cnt=0

for i in range(N-1):
    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=str(input())

list=[]

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

Submission status: Runtime Error

Solution code:
n = int(input())
s = list(input())
count = 0
if n % 3 != 0 and n >= 3:
  for i in range (1,n):  
    if s[i-1] == 'A' and s[i] == 'B' and s [i+1] == 'C':
      count += 1
elif n % 3 == 0 and n >= 3:
  for i in range(1, n-1):
    if s[i-1] == 'A' and s[i] == 'B' and s [i+1] == 'C':
      count += 1
if n == 2:
  print(0)
else:
  print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N=int(input())
S=input()
print(sum(S[i]==A and S[i+1]==B and S[i+2]==C for i in range(N-2)))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#-*- coding:utf-8 -*-
N=int(input())
S=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()
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 i in range (0,n-2):
  if S[i]=="A" and S[i+1]=="B" and S[i+2]=="C":
    ans+=1
print(ans)

Submission status: Runtime Error

Solution code:
def have_ABC_string(n, str):
    count = 0
    for i in range(n):
        if str[i] == 'A' and str[i+1] == 'B' and str[i+2] == 'C':
            count += 1
    return count

N = int(input())
S = input()
result = have_ABC_string(N, S)
print(result)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N=int(input())
S=[str(input()) for i in range N]
print(S.count("ABC"))

Submission status: Runtime Error

Solution code:
N=int(input())
S=[input() for i in range (N)]
S.count("ABC")

Submission status: Runtime Error

Solution code:
N=int(input())
S=str(input())
list_S=list(S)
ans=0

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

print(ans)

Submission status: Runtime Error

Solution code:
n=int(input())
s=list(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=int(input())
s=list(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 = int(input())
# n文字ぶんのsを書く
S = input()

result = 0
for i in range(N):
    1文字目から
    if S[i:i+2] == 'ABC':
        result += 1
print(result)

Submission status: Runtime Error

Solution code:
input = input()
result = 0
for i in range(len(input) - 2):
    serach = input[i:i+3]
    if serach == "ABC":
        result += 1
console.log(result)

Submission status: Runtime Error

Solution code:
import sys

def main():
    N = int(input().split())
    S = input()

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

    print(cnt)
main()

Submission status: Runtime Error

Solution code:
import sys

def main():
    N = int(input().split())
    S = input()

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

    print(cnt)
main()

Submission status: Runtime Error

Solution code:
import sys

def main():
    N = int(input().split())
    S = input()

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

    print(cnt)
main()

Submission status: Runtime Error

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

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:
n = int(input())
s = input()
i = 0
count = 0

while i < len(s):
    if not (s[i] == 'A'):
        i+=1
        continue
    i+=1
    if not (s[i] == 'B'):
        i+=1
        continue
    i+=1
    if not (s[i] == 'C'):
        i+=1
        continue
    i+=1
    count+=1

print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N=int(input())
S=input()
result=0
for i in range(N):
  if [i:i+3]=='ABC':
    result+=!
print(result)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
s = str(input())
S = list(s)
cnt = 0
for i in S:
    if S[i] == 'A':
        if S[i + 1] == 'B':
            if S[i + 2] == 'C':
                cnt += 1
print(cnt)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
S = input()
A = 0
for i in range(n-3):
  clipped_S = S[i:i+2]
  if clipped_S == "ABC"
    A += 1
print(A)

Submission status: Runtime Error

Solution code:
n=int(input())
s=input()
ans=s.cpount("ABC")
print(ans)

Submission status: Runtime Error

Solution code:
import collections

n = int(raw_input())
s = map(lambda x:ord(x) - ord('a'.upper()),list(raw_input()))

count,c = 0,0

0 1 2 
for i in s:
	if i == c:
		c +=1
	else:
		c = 0
		if i == c: c +=1
	if c == 3:
		count +=1
		c = 0
print count

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

count = 0
for i in range(N):
  if i == "ABC":
    count += 1
print("%d"%(count)

Submission status: Runtime Error

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

if "ABC" in s:
  print(s.count("ABC")
else:
  print(0)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
10
ZABCDBABCQ
---
2
===
19
THREEONEFOURONEFIVE
---
0
===
33
ABCCABCBABCCABACBCBBABCBCBCBCABCB
---
5
===

Submission status: Runtime Error

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

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=count+1
                i=i+3
            else:
                i=i+2
        else:
            i=i+1
print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=input()
s=raw_input().split()
num=0
for i in range(10000):
  if s[i]+s[i+1]+s[i+2]=="ABC":
    num+=1
print num

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=int(input())
s=list(input())
for i in s:
    if s[i]=="a" and s[i+1]=="b" and s[i+2]=="c":
        total+=1
print(total)

Submission status: Runtime Error

Solution code:
n=int(input())
s=list(input())
for i in s:
    if s[i]=="a" and s[i+1]=="b" and s[i+2]=="c":
        total+=1
print("total")

Submission status: Runtime Error

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

cnt = 0

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

print(cnt)

Submission status: Runtime Error

Solution code:
n=int(input())
s=input()
count=0
i=0
while i<=n-2:
    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)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=int(input())
s=input()
count=0
for i in range(len(n)-2):
  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()
count=0
for i in range(len(n)-3):
  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()
count = 0

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

Submission status: Runtime Error

Solution code:
N = int(input())
S = list(input())
cnt = 0
for i in range(i,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 = int(input())
lie = input()
li = list(lie)
cnt = 0
for i in range(len(li)):
    if li[i] == "A" and li[i+1] == "B" and li[i+2] == "C":
        cnt += 1
    else:
        pass
print(cnt)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

ans = 0;

for i in range(len(s)):
  3_str = s[i:i+2];
  ans += int(3_str == "ABC");

print(ans);

Submission status: Runtime Error

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

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

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()
cut = 0
for n in range(N+1):
    if S[n] == 'A' and S[n + 1] == 'B' and S[n + 2] == 'C':
        cut += 1

print(cut)

Submission status: Runtime Error

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

print(cut)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
S = [i for i in 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:
#--Count ABC

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-1):
    pp = A_list[j]
    if(S[pp+1]=="B" and S[pp+2]=="C"):
      k = k + 1
    else:
      pass
  else:
    pass

print(k)

Submission status: Runtime Error

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

count = 0

for i in range(1, N):
    if S[i-1] == 'A' and S[i] =='B' and S[i+1] == '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" 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()
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:
def countABC(N,S):
    flag = 0
    count = 0
    for i in range(len(N)):
        if S[i] == 'A' and flag == 0:
            flag = 1
        elif S[i] == 'B' and flag == 1:
            flag = 2
        elif S[i] == 'C' and flag == 2:
            count += 1
            flag = 0
    return count
        
        
        


if __name__ == "__main__":
    N = int(input())
    S = str(input())
    print(countABC(N,S))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys

N = 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)

Submission status: Runtime Error

Solution code:
N=int(input())
S=str(input())
cnt=0
for i in range(N):
    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())
A=list(input())
cnt=0

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

print(cnt)

Submission status: Runtime Error

Solution code:
n = int(input())
s = input()
cnt = 0
for i in range(n):
    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()
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)

Submission status: Runtime Error

Solution code:
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):
  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 = str(inout())
print(s.count('ABC'))

Submission status: Runtime Error

Solution code:
import math

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()
count = 0
for i in range(n):
  if s[i] == "A":
    if s[i+1]+s[i+2] == "BC":
      count += 1
print(count)

Submission status: Runtime Error

Solution code:
N = int(input())
S = list(input())
cnt = 0
i = 1
while True:
        if i == N:break
        if S[i-1] == "A" and S [i] == "B" and S[i+1] == "C":
                cnt += 1
        i += 1
print(cnt)

Submission status: Runtime Error

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

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

count = 0
flag = 0
for ch in s:
  if ch=='A' and flag==0:
    flag = 1
  else:
    flag = 0
  if ch=='B' and flag==1:
    flag = 2
  else:
    flag = 0
  if ch=='C' and flag==2
  	flag = 3
  else: flag = 0
  if flag==3:
    count += 1
    flag = 0

print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

k = 0

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
s = input()      
pattern = list('ABC')          
cnt = 0

for i in range(n):
    for j in range(3):
        if s[i + j] != pattern[j]:
            match = False
            break
    if match:                   # すべての文字が一致していればカウント
        cnt += 1

print(cnt)

Submission status: Runtime Error

Solution code:
n = int(input())
s = input()            # テキストをリストに変換
pattern = list('ABC')          # パターンをリストに変換
cnt = 0

for i in range(n):
    match = True                # 一致しているものとして探索開始
    for j in range(len(pattern)):
        if s[i + j] != pattern[j]:
            match = False       # 一致しなかった
    if match:                   # すべての文字が一致していればカウント
        cnt += 1

print(cnt)

Submission status: Runtime Error

Solution code:
n = int(input())
text = input()            # テキストをリストに変換
pattern = list('ABC')          # パターンをリストに変換
cnt = 0

for i in range(n):
    match = True                # 一致しているものとして探索開始
    for j in range(len(pattern)):
        if text[i + j] != pattern[j]:
            match = False       # 一致しなかった
            break
    if match:                   # すべての文字が一致していればカウント
        cnt += 1

print(cnt)

Submission status: Runtime Error

Solution code:
n = int(input())
text = input(list())            # テキストをリストに変換
pattern = list('ABC')          # パターンをリストに変換
cnt = 0

for i in range(n):
    match = True                # 一致しているものとして探索開始
    for j in range(len(pattern)):
        if text[i + j] != pattern[j]:
            match = False       # 一致しなかった
            break
    if match:                   # すべての文字が一致していれば出力
        cnt += 1

print(cnt)

Submission status: Runtime Error

Solution code:
n = int(input())
text = input(list()            # テキストをリストに変換
pattern = list('ABC')          # パターンをリストに変換
cnt = 0

for i in range(n):
    match = True                # 一致しているものとして探索開始
    for j in range(len(pattern)):
        if text[i + j] != pattern[j]:
            match = False       # 一致しなかった
            break
    if match:                   # すべての文字が一致していれば出力
        cnt += 1

print(cnt)

Submission status: Runtime Error

Solution code:
n = int(input())
text = input(list()            # テキストをリストに変換
pattern = list('ABC')          # パターンをリストに変換


for i in range(n):
    match = True                # 一致しているものとして探索開始
    for j in range(len(pattern)):
        if text[i + j] != pattern[j]:
            match = False       # 一致しなかった
            break
    if match:                   # すべての文字が一致していれば出力
        print(i)
        break

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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