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: Wrong Answer

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

Submission status: Wrong Answer

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

count = 0
for i in range(n-3):
    target = text[i:i+3]
    if target == 'ABC':
        count += 1

print(count)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

flg_A,flg_B = False,False
count = 0

for word in S:
    if flg_B and flg_A:
        if word=="C":
            count += 1
            flg_A,flg_B = False,False
        else:
            flg_A,flg_B = False,False
    
    elif flg_A:
        if word=="B":
            flg_B = True
        else:
            flg_A = False
    
    elif word=="A":
        flg_A = True

print(count)

Submission status: Wrong Answer

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

if n == 10:
    print(2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

cnt=0

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

print(cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# 各桁の数値の総和を計算する.
def calc_digit_sum(num):
    sums = 0
    while num > 0:
        sums += num % 10
        num //= 10
    return sums


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

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

Submission status: Wrong Answer

Solution code:
input()
s = input()
l = len(s)
s.replace('ABC', '')
 
l2 = len(s)
 
print((l-l2) // 3)

Submission status: Wrong Answer

Solution code:
input()
s = input()
l = len(s)
s.replace('ABC', '')

l2 = len(s)

print(l-l2 // 3)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

abc = "ABC"
ans = 0
j = 0

for i in range(N):
    if S[i] == abc[j]:
        j += 1
        if S[i] == "C":
            j = 0
            ans += 1
    else:
        j = 0
else:
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
n = input()
w = input()
w.count('ABC')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
moji = str(input())
print(moji.count("ABC"))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

#print(s.count('ABC'))
for ni in range(n-3):
  if s[ni:ni+3] == 'ABC':
    ans += 1
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(nabc)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
print(len(input().split("ABC")) - 1)

Submission status: Wrong Answer

Solution code:
print(len(input().split("ABC")))

Submission status: Wrong Answer

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

if '__main__' == __name__:
    resolve()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
_ = 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 += 1
    elif word == 2 and i =='C':
        word = 0
        cnt += 1
    else:
        word = 0
print(cnt)

Submission status: Wrong Answer

Solution code:
N=int(input())
s=str(input())
ans=1
if 'ABC' in s:
    ans=ans+1
print(ans)

Submission status: Wrong Answer

Solution code:
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-3):
    if ''.join(array_S[I:I+3]) == 'ABC':
        count += 1
print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
count=0
s=input()
for i in s:
  if i=="ABC":
    count+=1  
print(count)

Submission status: Wrong Answer

Solution code:
def main():
  N = int(input())
  S = str(input())
  l = 0
  ans = 0
  p = ''
  for i in range(N):
      if S[i] == 'A' and p == '':
          l += 1
          p = S[i]
      elif S[i] == 'B' and l == 1 and p == 'A':
          l += 1
          p = S[i]
      elif S[i] == 'C' and l == 2 and p == 'B':
          ans += 1
          l = 0
      else:
          l = 0
          p = ''
  print(ans)
main()

Submission status: Wrong Answer

Solution code:
def main():
  N = int(input())
  S = str(input())
  l = 0
  ans = 0
  p = ''
  for i in range(N):
      if S[i] == 'A' and p == '':
          l += 1
          p = S[i]
      elif S[i] == 'B' and l == 1 and p == 'A':
          l += 1
      elif S[i] == 'C' and l == 2 and p == 'B':
          ans += 1
          l = 0
      else:
          l = 0
          p = ''
  print(ans)
main()

Submission status: Wrong Answer

Solution code:
def main():
  N = int(input())
  S = str(input())
  l = 0
  ans = 0
  for i in range(N):
      if S[i] == 'A':
          l += 1
      elif S[i] == 'B' and l == 1:
          l += 1
      elif S[i] == 'C' and l == 2:
          ans += 1
          l = 0
      else:
          l = 0
  print(ans)
main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
input()
string = input()

count = 0

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


print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = input()
idx = 0
res = 0
while idx + 3 < N:
    if S[idx] == 'A':
        if S[idx:idx+3] == 'ABC':
            res += 1 
            idx += 3
    idx += 1
print(res)

Submission status: Wrong Answer

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

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

print(count)

Submission status: Wrong Answer

Solution code:
s1=input()

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
s = input()
c = 0
for i in range(n-3):
    if s[i] == 'A' and s[i:i+3] == 'ABC':
        c += 1
print(c)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = input()
s = input()
 
count = 0
last_is_A = False
last_is_B = False
 
for v in s:
  if v=='A':
    last_is_A = True
    continue
  if last_is_A and v=='B':
    last_is_A = False
    last_is_B = True
    continue
  if last_is_B and v=='C':
    count += 1
  last_is_A = False
  last_is_B = False
print(count)

Submission status: Wrong Answer

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

count = 0
last_is_A = False
last_is_B = False

for v in s:
  if v=='A':
    last_is_A = True
  if last_is_A and v=='B':
    last_is_A = False
    last_is_B = True
  if last_is_B and v=='C':
    count += 1
    last_is_B = False
print(count)

Submission status: Wrong Answer

Solution code:
n=int(input())
s=input()
t="ABC"
ans=0
for i in range(len(s)-3):
    if(s[i:i+3]==t):ans+=1

print(ans)

Submission status: Wrong Answer

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

    prev = ''
    c = 0

    for i in s:
        if prev == '':
            if i == 'A':
                prev = 'A'
        elif prev == 'A':
            if i == 'A':
                prev = 'A'
            elif i == 'B':
                prev = 'B'
            else:
                prev == ''
        elif prev == 'B':
            if i == 'A':
                prev = 'A'
            elif i == 'C':
                c += 1
                prev = ''
            else:
                prev = ''

    print(c)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

    prev = ''
    c = 0

    for i in s:
        if prev == '':
            if i == 'A':
                prev = 'A'
        elif prev == 'A':
            if i == 'A':
                pass
            elif i == 'B':
                prev = 'B'
            else:
                i == ''
        elif prev == 'B':
            if i == 'A':
                prev = 'A'
            elif i == 'C':
                c += 1
                prev = ''
            else:
                prev = ''

    print(c)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

    prev = ''
    c = 0

    for i in s:
        if prev == '':
            if i == 'A':
                prev = 'A'
        elif prev == 'A':
            if i == 'A':
                pass
            elif i == 'A':
                prev = 'B'
            else:
                i == ''
        elif prev == 'B':
            if i == 'A':
                prev = 'A'
            elif i == 'C':
                c += 1
                prev = ''
            else:
                prev = ''

    print(c)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def solve():
    n = int(input())
    s = input()
    state = 0
    count = 0
    for c in s:
        if c == 'A':
            state += 1
            continue
        elif state == 1 and c == 'B':
            state += 1
            continue
        elif state == 2 and c == 'C':
            count += 1
        state = 0

    print(count)

if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
import sys
from itertools import combinations
import math


def I(): return int(sys.stdin.readline().rstrip())


def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))


def S(): return sys.stdin.readline().rstrip()


def LS(): return list(sys.stdin.readline().rstrip().split())


n = I()
s = S()
# print(s.count('ABC'))
ans = 0
for i in range(len(s)-3):
    if s[i] == 'A' and s[i+1] == 'B' and s[i+2] == 'C':
        ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
s=input()
l=[]
count=0
for i in s:
    if i=='A':
        l.append('A')
    elif i=='B' and l==['A']:
        l.append('B')
    elif i=='C' and l==['A','B']:
        l=[]
        count+=1
    else:
        l=[]
print(count)

Submission status: Wrong Answer

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

S.replace('ABC','x')
print(S.count('x'))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
s = input()
f = "ABC"
cnt = 0
tmp = None
for s_ in s:
    if not tmp and s_ == "A":
        tmp = "A"
    elif tmp == "A" and s_ == "B":
        tmp = "B"
    elif tmp == "B" and s_ == "C":
        cnt += 1
        tmp = None
    else:
        tmp = None
print(cnt)

Submission status: Wrong Answer

Solution code:
import sys

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

Solution code:
S = input()

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

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
cha = input()
if "ABC" in cha:
    print(cha.count("ABC"))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

import math
ans = 0

for i in range(math.ceil(len(S)/3)):
    if S[i:i+3] == "ABC":
        ans += 1
    else:
        pass
print(ans)

Submission status: Wrong Answer

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

import math
ans = 0

for i in range(math.ceil(len(S)/3)):
    print(S[i:i+3])
    if S[i:i+3] == "ABC":
        ans += 1
    else:
        pass
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
a = int(input())
s = input()
cnt = 0
i = 0
while i < a:
    if s[i:i+3] == 'ABC':
        cnt += 1
        i += 3
    i += 1
print(cnt)

Submission status: Wrong Answer

Solution code:
n = input()
s = input()
prev = ""
cnt = 0
flag = False
for i in s:
    if flag:
        if i == "C" and prev == "B":
            cnt += 1
            flag = False
        elif i == "B" and prev == "A":
            prev = i
            continue
        else:
            flag = False
    elif i == "A":
        flag = True
    prev = i

print(cnt)

Submission status: Wrong Answer

Solution code:
n = input()
s = input()
prev = ""
cnt = 0
flag = False
for i in s:
    if flag:
        if i == "C" and prev == "B":
            cnt += 1
            flag = False
    elif i == "A":
        flag = True
    prev = i

print(cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=input()
s=input()
print(s.count('abc'))

Submission status: Wrong Answer

Solution code:

def search(N):
    ans = False
    if not N >= 90:
        for i in range(1,10):
            if N%i == 0 and 1 <= N // i <= 9:
                ans = True
                break
            else:
                pass        
    return ans

N = int(input())
if search(N):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import collections

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

count,c = 0,0
for i in s:
	if i == c:
		c +=1
	else:
		c = 0

	if c == 3:
		count +=1
		c = 0
print count

Submission status: Wrong Answer

Solution code:
import collections

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

count,c = 0,0
for i in s:
	if i == c:
		c +=1
	else:
		c = 0

	if c == 2:
		count +=1
		c = 0
print count

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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 += 1

print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = input()
print(sum(S[i:i + 3] == "ABC" for i in range(N - 3)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    import sys
    input = sys.stdin.readline

    N = int(input())
    S = list(input().rsplit()[0])

    ans = 0
    for i in range(len(S)-3):
        s = "".join(S[i:i+3])
        if s == 'ABC':
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input()) 
s = input()
print(s.count('abc'))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
if __name__ == "__main__":
    n = int(input())
    s = input()

    ans = 0

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

    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = 0

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
s = input()
cnt = 0
for i in range(n-3):
    if s[i:i+3] == "ABC":
        cnt += 1

print(cnt)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

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

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

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = 13
S = ['A','B','D','H','A','C','B','B','X','Z','C','D','A']
A = (S. count('A'))
B = (S. count('B'))
C = (S. count('C'))
print(A+C+B)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = input()
S = S.split('C')
cut = 0
for s in S:
    s = s + 'C'
    if "ABC" in s:
        cut += 1
print(cut)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
s = input()
print(s.count('abc'))

Submission status: Wrong Answer

Solution code:
n=int(input())
s=input()
t=s.replace('ABC','c')
print(t.count('a'))

Submission status: Wrong Answer

Solution code:
n=int(input())
s=input()
s.replace('ABC','a2c')
print(s.count('a2c'))

Submission status: Wrong Answer

Solution code:
n=int(input())
s=input()
s.replace('ABC','a')
print(s.count('a'))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
s = input()
print(s.find('ABC'))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def countABC(N,S):
    flag = 0
    count = 0
    for i in range(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
        else:
            flag = 0
    return count
        
        
        


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

Submission status: Wrong Answer

Solution code:
def countABC(N,S):
    flag = 0
    count = 0
    for i in range(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: Wrong Answer

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

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

print(new_S)
print(new_S.count("@"))

Submission status: Wrong Answer

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

k = s*n
print(k.count('ABC'))

Submission status: Wrong Answer

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

print(s.count('ABC')*n)

Submission status: Wrong Answer

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