ZhenlongDai/ACPR huggingface dataset:
Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = input()
S = input("Enter String")
count = 0
for i in range(1, int(N)-1):
    if S[i-1]+S[i]+S[i+1] == "ABC":
        count += 1
print(count)

Failing test case input:
33
ABBCABCCCCCACBACBCBAABCDBDBBCABCA

Expected output:
3


Actual output:
Enter String3


Fixed submission (verdict: Accepted):
N = input()
S = input()
count = 0
if(int(N)>=3 and int(N)<=50):
    for i in range(1, int(N)-1):
        if S[i-1]+S[i]+S[i+1] == "ABC":
            count += 1
    print(count)

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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 = ans + 1
          

Failing test case input:
33
BCBACBDBCBCBABBCBCABCACBABCBACCBA

Expected output:
2


Actual output:

Fixed submission (verdict: Accepted):
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 = ans + 1
    
print(ans)

Problem: p02812
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = input()
w = input()
w.count('ABC')

Failing test case input:
10
ZABCDB@BCQ

Expected output:
1


Actual output:

Fixed submission (verdict: Accepted):
input()
w = input()
print(w.count('ABC'))

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from functools import lru_cache
import sys

sys.setrecursionlimit(10**8)

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

@lru_cache(maxsize=None)
def dp(s):
    print(s.count("ABC"))
print(dp(S))



Failing test case input:
10
BDBAQCCBAY

Expected output:
0


Actual output:
0
None


Fixed submission (verdict: Accepted):
from functools import lru_cache
import sys

sys.setrecursionlimit(10**8)

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

@lru_cache(maxsize=None)
def dp(s):
    result = s.count("ABC")
    return result
print(dp(S))

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()
print(S.count("ABC"))

Failing test case input:
33
ABBCABCBABCACBACBCBBABCBCBDBCABCB

Expected output:
4


Actual output:
0


Fixed submission (verdict: Accepted):
N = int(input())
S = input()
print(S.count("ABC"))

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = list(input())

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

print(count)

Failing test case input:
33
BDBACBCBCBCBABBCBCABACCBABCBACCBA

Expected output:
1


Actual output:
3


Fixed submission (verdict: Accepted):
N = int(input())
S = list(input())

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

print(count)
Problem: p02812
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
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)

Failing test case input:
33
ABBCABCCCBCACBACBCBAABCDCCBBCABCA

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
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
    elif S[i] == "A":
        j = 1
    else:
        j = 0
print(ans)

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
s=input()

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

Failing test case input:
33
ABBAABCCCCDADBBDBBAAABCDCDBCDCBCA

Expected output:
2


Actual output:
0


Fixed submission (verdict: Accepted):
n=int(input())
s=input()

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

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = input()      
pattern = list('ABC')          
cnt = 0
match = True

for i in range(n-len(pattern)):
    if (s[i] == pattern[0]) and (s[i+ 1] == pattern[1]) and (s[i+ 2] == pattern[2]):
        cnt += 1
if n % 3 == 0:
    print(cnt + 1)
else:
    print(cnt)

Failing test case input:
33
ABCCABCBABCCABACBCBBABCBCBCBCABCB

Expected output:
5

Actual output:
6


Fixed submission (verdict: Accepted):
n = int(input())
s = input()      
pattern = list('ABC')          
cnt = 0

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

print(cnt)

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

n = int(10)
s = list('ZABCDBABCQ')

result = 0
for i in range(len(s)):
    if (i > n - 3):
        break
    if (s[i] == 'A' and s[i+1] == 'B' and s[i+2] == 'C'):
        result = result + 1

print(result)

Failing test case input:
10
BDAAQBCBAY

Expected output:
0


Actual output:
2


Fixed submission (verdict: Accepted):
n = int(input())
s = list(input())

result = 0
for i in range(len(s)):
    if (i > n - 3):
        break
    if (s[i] == 'A' and s[i+1] == 'B' and s[i+2] == 'C'):
        result = result + 1

print(result)

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
x=input()
x.count("ABC")

Failing test case input:
33
ABBCABCBABCACBACBCBCABCBCBDBCABCB

Expected output:
4


Actual output:

Fixed submission (verdict: Accepted):
n=int(input())
x=input()
y=x.count("ABC")
print(y)
Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
input()
s = input()
i = s.find('ABC')
n = 0
while i != -1:
  i = s.find('ABC')
  s = s[i + 3:]
print(n)


Failing test case input:
33
ABBCABCCCCCACBACBCBAABCDBCBBCABCA

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):
input()
s = input()
n = 0
i = 0
while i != -1:
  i = s.find('ABC')
  s = s[i+3:]
  n += 1
print(n-1)

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=input()
S=input()

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

Failing test case input:
33
ACBACCBDBDCBAABCBDBBCACCCCCBABBBA

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
N=input()
S=input()

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

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
num = int(input())
word = input()
if len(word) >= num:
    print(word[0:num].count('ABC'))
print(0)      
       


Failing test case input:
33
ABBCABCCCCCACBACBCBAABCDBCBBCABCA

Expected output:
3


Actual output:
3
0


Fixed submission (verdict: Accepted):
num = int(input())
word = input()
if len(word) >= num:
    print(word[0:num].count('ABC'))
else:
    print(0)

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
N = len(s)
ans = 0
if N < 3:print(0);exit()
for i in range(N-2):
  if s[i]=='A' and s[i+1]=='B' and s[i+2] == 'C':ans += 1

print(ans)


Failing test case input:
10
YABCCQABDB

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
N = int(input())
s = input()
ans = 0
if N < 3:print(0);exit()
for i in range(N-2):
  if s[i:i+3] == 'ABC':ans += 1

print(ans)

Problem: p02812
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
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

Failing test case input:
19
SOREUENEROEWONHFIGE

Expected output:
0


Actual output:

Fixed submission (verdict: Accepted):
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)

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()

print(S.count("ABC"))

Failing test case input:
10
YABCCQABDB

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
N = input()
S = input()

print(S.count("ABC"))

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = int(input())
b = input()
c = list(b)
for i  in range(a - 2):
    j = 0
    if c[i] == 'A' and c[i + 1] == 'B' and c[i + 2] == 'C':
        j += 1
print(j)

Failing test case input:
33
ABBCABCCCBCACBACBCBAABCDBCBBCABCA

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):
a = int(input())
b = input()
c = list(b)
j = 0
for i  in range(a - 2):
    if c[i] == 'A' and c[i + 1] == 'B' and c[i + 2] == 'C':
        j += 1
print(j)
Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
s = input()
print(s.count("abc"))

Failing test case input:
33
ABBCABCBCBCACBACBCBAABCDCCBBCABCA

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):
N = int(input())
s = input()
print(s.count("ABC"))

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = input()      
pattern = list('ABC')          
cnt = 0
match = False

for i in range(n-len(pattern)):
    if (s[i] == pattern[0]) and (s[i+ 1] == pattern[1]) and (s[i+ 2] == pattern[2]):
        cnt += 1
        match = True
if n % 3 == 0 and match:
    print(cnt + 1)
else:
    print(cnt)

Failing test case input:
33
ACBACCBDBDCBAABCBCBBCACCCCCBACBBA

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
n = int(input())
s = input()      
pattern = list('ABC')          
cnt = 0

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

print(cnt)

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
print(input().count('ABC'))

Failing test case input:
33
BDBACBCBCBCBABBCBCABACCBABCBACCBA

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
input()
print(input().count('ABC'))

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = input()
c = 0
for i in range(N-2):
  S[i] + S[i+1] + S[i+2] == 'ABC'
  c += 1
print(c)


Failing test case input:
19
SOREUENEROEWONHFIGD

Expected output:
0


Actual output:
17


Fixed submission (verdict: Accepted):
N = int(input())
S = input()
c = 0
for i in range(N-2):
  if (S[i] + S[i+1] + S[i+2]) == 'ABC':
    c += 1
print(c)

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
A=input()

i=0
ans=0
while(True):
  if i>N-3:
    break
  if A[i]=='A' and A[i+1]=='B' and A[i+2]=='C':
    ans+=1
    i+=3
  else:
    i+=1

Failing test case input:
19
OGIONSEVRFSFNETDHPF

Expected output:
0


Actual output:

Fixed submission (verdict: Accepted):
N=int(input())
A=input()

i=0
ans=0
while(True):
  if i>N-3:
    break
  if A[i]=='A' and A[i+1]=='B' and A[i+2]=='C':
    ans+=1
    i+=3
  else:
    i+=1
print(ans)

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def resolve():
    _, S = [input() for i in range(2)]

    print(S.count('abc'))


if __name__ == "__main__":
    resolve()

Failing test case input:
33
ABBCABCBABCACBACBCBBABCBCBDBCABCB

Expected output:
4


Actual output:
0


Fixed submission (verdict: Accepted):
def resolve():
    _, S = [input() for i in range(2)]

    print(S.count('abc') + S.count('ABC'))


if __name__ == "__main__":
    resolve()
Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

def main():
    N = int(input())
    S = input().rstrip()
    ans = sum(S[i + 3] == "ABC" for i in range(N - 3))
    print(ans)


if __name__ == "__main__":
    main()


Failing test case input:
33
ABBCABCBABCACBACBCBBABCBCBDBCABCB

Expected output:
4


Actual output:
0


Fixed submission (verdict: Accepted):

def main():
    N = int(input())
    S = input().rstrip()
    ans = sum(S[i:i + 3] == "ABC" for i in range(N - 2))
    print(ans)


if __name__ == "__main__":
    main()

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
input = input()
result = 0
for i in range(len(input) - 2):
    serach = input[i:i+3]
    if serach == "ABC":
        result += 1
print(result)

Failing test case input:
33
ABBCABCBABCACBACBCBCABCBCCDBCABCB

Expected output:
4


Actual output:
0


Fixed submission (verdict: Accepted):
num = input()
input = input()
result = 0
for i in range(len(input) - 2):
    serach = input[i:i+3]
    if serach == "ABC":
        result += 1
print(result)

Problem: p02812
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
s = input()
print(s.count('ABC'))

Failing test case input:
33
ABBCABCBABCACBACBCBCABCDCCBBCABCA

Expected output:
4


Actual output:
0


Fixed submission (verdict: Accepted):
N = int(input())
s = input()
print(s.count('ABC'))

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
s=input()
t=s.replace('ABC','c')
print(t.count('a'))

Failing test case input:
33
BDBACBCBCBCBABBCBCABACCBABCBACCBA

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
n=int(input())
s=input()
t=s.replace('ABC','a')
print(t.count('a'))

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
S=input()
ans=0
for i in range(N-2):
    if S[i:i+3]=='abc' :
        ans+=1
print(ans)

Failing test case input:
33
BDBACBCBCBCBABBCBCABACCBABCBACCBA

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
N=int(input())
S=input()
ans=0
for i in range(N-2):
    if S[i:i+3]=='ABC' :
        ans+=1
print(ans)
Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = input()
state = 0
ans = 0

def isABC(s):
    global state
    if state==0:
        if s=="A":
            state = 1
        return 0
    elif state==1:
        if s=="B":
            state = 2
        else:
            state=0
        return 0
    else:
        if s=="C":
            state=0
            return 1
        else:
            state=0
            return 0

for i in S:
    ans += isABC(i)
print(ans)

Failing test case input:
33
ABBAABCCCCCADBBDBBAAABCDBDBCCBBCA

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
N = int(input())
S = input()
state = 0
ans = 0

def isABC(s):
    global state
    if state==0:
        if s=="A":
            state = 1
        return 0
    elif state==1:
        if s=="B":
            state = 2
        elif s=="A":
            state=1
        else:
            state=0
        return 0
    else:
        if s=="C":
            state=0
            return 1
        elif s=="A":
            state=1
            return 0
        else:
            state=0
            return 0

for i in S:
    ans += isABC(i)
print(ans)

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = input()
length = len(S)
num = 0
print(length)
for i in range(length-2) :
  if S[i:i+3] == "ABC" :
    num += 1
print(num)

Failing test case input:
33
BDBACBCBCBCBABBCBCABACCBABCBACCBA

Expected output:
1


Actual output:
33
1


Fixed submission (verdict: Accepted):
N = int(input())
S = input()
length = len(S)
num = 0
for i in range(length-2) :
  if S[i:i+3] == "ABC" :
    num += 1
print(num)

Problem: p02812
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
def p_b():
    n = int(input())
    s = input()
    ans = 0
    for i in range(n - 2):
        if "ABC" == s[i:i + 3]:
            ans += 1
            
p_b()

Failing test case input:
19
RONFUENERFEWORHFIGO

Expected output:
0


Actual output:

Fixed submission (verdict: Accepted):
def p_b():
    n = int(input())
    s = input()
    ans = 0
    for i in range(n - 2):
        if "ABC" == s[i:i + 3]:
            ans += 1
    print(ans)
    
p_b()

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = str(input())
S = S.replace("abc","pq")
print(N - len(S))


Failing test case input:
33
ABBCABCCCCCACBACBCBAABCDBDBCCABCA

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):
N = int(input())
S = str(input())
S = S.replace("ABC","ab")
print(N - len(S))

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
N = len(s)
ans = 0
if N < 3:print(0);exit()
for i in range(N-3):
  if s[i:i+3] == 'ABC':ans += 1

print(ans)

Failing test case input:
33
ABBCABCBCBCACBACBCBAABCDCCBBCABCA

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):
N = int(input())
s = input()
ans = 0
if N < 3:print(0);exit()
for i in range(N-2):
  if s[i:i+3] == 'ABC':ans += 1

print(ans)
Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N= int(input())
M= input()
print(M.find("ABC"))

Failing test case input:
19
OGIRHSOWEFRENETFNOF

Expected output:
0


Actual output:
-1


Fixed submission (verdict: Accepted):
N= int(input())
M= input()
print(M.count("ABC"))

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=input()
S=input() 
cnt=0 
y=S.find("ABC")
if y==-1:
    print(0)
else:
    while y!=-1:
        S=S.replace(S[:y],"")
        S=S.replace("ABC","",1) 
        y=S.find("ABC")
        cnt+=1 
    print(cnt) 

Failing test case input:
33
ABBCABCBABCACBACBCBBABCBCBDBCABCB

Expected output:
4


Actual output:
2


Fixed submission (verdict: Accepted):
N=input()
S=input() 
cnt=0 
y=S.find("ABC")
if y==-1:
    print(0)
else:
    while y!=-1:
        S=S.replace(S[:y],"",1)
        S=S.replace("ABC","",1) 
        y=S.find("ABC")
        cnt+=1 
    print(cnt)

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import re

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

abc = re.compile('ABC')

count = abc.findall(s)
print(count)

Failing test case input:
19
OGIOHSEWRFRFNETDNPF

Expected output:
0


Actual output:

Fixed submission (verdict: Accepted):
import re
 
n = int(input())
s = input()
 
abc = re.compile('ABC')
 
count = len(abc.findall(s))
print(count)

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
a=0
a=s.count('ABC')
print(a)

Failing test case input:
33
ABBCABCCCBCACBACBCBAABCDCCBBCABCA

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):
n=int(input())
s=input()
a=s.count('ABC')
print(a)

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
s=input()
cnt=0
for i in range(0,N-3):
  if s[i]+s[i+1]+s[i+2]=="abc":
    cnt+=1
print(cnt)

Failing test case input:
33
BCBACBDBCBCBABBCBCABCACBABCBACCBA

Expected output:
2


Actual output:
0


Fixed submission (verdict: Accepted):
N=int(input())
s=input()
cnt=0
for i in range(0,N-2):
  if s[i]+s[i+1]+s[i+2]=="ABC":
    cnt+=1
print(cnt)

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = input()
flag = 0
for i in range(n-1):
    if i == n-3:
        break
        if s[i] == 'A':
            if s[i+1] == 'B':
                if s[i+2] == 'C':
                    flag =+ 1
print(flag)

Failing test case input:
10
ZABCCB@CDQ

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
n = int(input())
s = input()
flag = 0
for i in range(n-1):
    if i == n-2:
        break
    if s[i] == 'A':
        if s[i+1] == 'B':
            if s[i+2] == 'C':
                flag += 1
print(flag)
Problem: p02812
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import sys; readline = sys.stdin.readline
from collections import deque

n = int(readline())
s = readline().rstrip()

count = 0

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

print(count)

Failing test case input:
10
ZABCCB@BDQ

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
import sys; readline = sys.stdin.readline
from collections import deque

N = int(readline())
S = readline().rstrip()

count = 0

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

print(count)

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = input()

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

print(cnt)

Failing test case input:
19
SHREEONEROUVONEFIFD

Expected output:
0


Actual output:
SHR
HRE
REE
EEO
EON
ONE
NER
ERO
ROU
OUV
UVO
VON
ONE
NEF
EFI
FIF
IFD
FD
D
0


Fixed submission (verdict: Accepted):
N = int(input())
S = input()

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

print(cnt)

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
input()

S = input()

print(sorted(S).count("ABC"))

Failing test case input:
33
BCBACBDBCBCBABBCBCABCACBABCBACBBA

Expected output:
2


Actual output:
0


Fixed submission (verdict: Accepted):
N = int(input())
S = input()

print(S.count("ABC"))

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
s=input()
s.replace('ABC','a2c')
print(s.count('a2c'))

Failing test case input:
10
ZABCCQ@BDB

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
n=int(input())
s=input()
t=s.replace('ABC','a')
print(t.count('a'))

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = input()
c = 0
for i in range(N-2):
  if S[i:i+3]=="ABC":
    c += 0
print(c)

Failing test case input:
33
ACBACBBCBDCBAABCBCABCACCCCCBACBBA

Expected output:
2


Actual output:
0


Fixed submission (verdict: Accepted):
N = int(input())
S = input()
c = 0
for i in range(N-2):
  if S[i:i+3]=="ABC":
    c += 1
print(c)

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x = input()
print(x.count("ABC"))

Failing test case input:
33
ABBAABCCCCCADBBDBBAAABCDBDBCCBBCA

Expected output:
2


Actual output:
0


Fixed submission (verdict: Accepted):
x = input()
x = input()
print(x.count("ABC"))
Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
length_count = input()
strings = input()

abc_count = 0
a = False
b = False

strings_list = list(strings)

for char in strings_list:
    if char == 'A':
        a = True
    elif char == 'B' and a:
        b = True
    elif char == 'C' and a and b:
        abc_count += 1
        a = False
        b = False
    else:
        a = False
        b = False

print(abc_count)

Failing test case input:
33
ABBCABCCCCCACBACBCBAABCDBDBBCABCA

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):
length_count = int(input())
strings = input()

abc_count = 0
a = False
b = False

strings_list = list(strings)

for i in range(length_count):
    
    if strings_list[i] == 'A':
        a = True
        b = False

    elif strings_list[i] == 'B' and a:
        if b:
            a = False
            b = False
        b = True
        
    elif strings_list[i] == 'C' and a and b:
        abc_count += 1
        a = False
        b = False
    else:
        a = False
        b = False

print(abc_count)

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = input()
cnt = 0
flag = 0
for i in range(n):
  if s[i] == "A":
    flag = 1
  elif s[i] == "B" and flag == 1:
    flag = 2
  elif s[i] == "C" and flag == 2:
    cnt += 1
    flag = 0
print(cnt)

Failing test case input:
33
ABBCABCBABCACBACBCBCABCBCBDBCABCB

Expected output:
4


Actual output:
6


Fixed submission (verdict: Accepted):
n = int(input())
s = input()
cnt = 0
flag = 0
for i in range(n):
  if s[i] == "A":
    flag = 1
  elif s[i] == "B" and flag == 1:
    flag = 2
  elif s[i] == "C" and flag == 2:
    cnt += 1
    flag = 0
  else:
    flag = 0
print(cnt)

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
print(input().count("ABC"))

Failing test case input:
33
ABBCABCBABCACBACBCBCABCBCCDBCABCB

Expected output:
4


Actual output:
0


Fixed submission (verdict: Accepted):
input()
print(input().count("ABC"))

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
letters = input()
cnt = 0
for i in range(n):
    if letters[i:i+3]=="abc":
        cnt += 1

print(cnt)

Failing test case input:
10
YABCBQAADC

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
n = int(input())
letters = input()
cnt = 0
for i in range(n):
    if letters[i:i+3]=="ABC":
        cnt += 1

print(cnt)

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = input()
count = 0
for i in range(n-2):
  print(s[i:i+3])
  if s[i:i+3] == "ABC":
    count += 1
print(count)


Failing test case input:
19
RONFUENEROEWORHFIGE

Expected output:
0


Actual output:
RON
ONF
NFU
FUE
UEN
ENE
NER
ERO
ROE
OEW
EWO
WOR
ORH
RHF
HFI
FIG
IGE
0


Fixed submission (verdict: Accepted):
n = int(input())
s = input()
count = 0
for i in range(n-2):
  if s[i:i+3] == "ABC":
    count += 1
print(count)
Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = input()

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

print(ans)

Failing test case input:
33
ACBACCBDBDCBAABCBDBBCACCCCCBABBBA

Expected output:
1


Actual output:
ACBACCBDBDCBAABCBDBBCACCCCCBABBBA
1


Fixed submission (verdict: Accepted):
N = int(input())
S = input()

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

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = input()

res = 0
phase = 0
for c in s:
    if c == "A" and phase == 0:
        phase = 1
        continue
    elif c == "B" and phase == 1:
        phase = 2
        continue
    elif c == "C" and phase == 2:
        res += 1
    phase = 0

print(res)

Failing test case input:
33
ABBCABCCCCCACBACBCBAABCDBDBBCABCA

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
n = int(input())
s = input()

res = 0
phase = 0
for c in s:
    if c == "A":
        phase = 1
    elif c == "B" and phase == 1:
        phase = 2
    elif c == "C" and phase == 2:
        phase = 0
        res += 1
    else:
        phase = 0

print(res)

Problem: p02812
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):

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

if __name__ == '__main__':
    main()



Failing test case input:
10
ZABCDB@BCQ

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):

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

if __name__ == '__main__':
    main()

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
33
ABCCABCBABCCABACBCBBABCBCBCBCABDB

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):
N = int(input())
S = list(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)

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = int(input())
b = input()
c = list(b)
for i  in range(a - 2):
    j = 0
    if c[i] == 'A' and c[i + 1] == 'B' and c[i + 2] == 'C':
        j = j + 1
print(j)

Failing test case input:
10
ZABCCQ@BDB

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
a = int(input())
b = input()
c = list(b)
j = 0
for i  in range(a - 2):
    if c[i] == 'A' and c[i + 1] == 'B' and c[i + 2] == 'C':
        j += 1
print(j)
Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
print(s.count('ABC'))

Failing test case input:
33
ABBCABCCCCCACBACBCBAABCDBCBBCABCA

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):
n=int(input())
s=input()
print(s.count('ABC'))

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
S=input()
ans=0
a=0
b=0
c=0
for i in S:
	if i=='A':
		if a==0:
			a=1
		else:
			a=0
	elif i=='B' and a==1:
		if b==0:
			b=1
		else:
			b=0
	elif i=='C' and a==1 and b==1:
		c=1
		ans+=c
		a=b=c=0
	else:
		a=b=c=0
print(ans)

Failing test case input:
33
ACBACCBDBDCBAABCBDBBCACCCCCBABBBA

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
N=int(input())
S=input()
ans=0
a=0
b=0
c=0
for i in S:
	if i=='A':
		a=1
		b=c=0
	elif i=='B' and a==1:
		if b==0:
			b=1
		else:
			a=0
			b=0
	elif i=='C' and a==1 and b==1:
		c=1
		ans+=c
		a=b=c=0
	else:
		a=b=c=0
print(ans)

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = input()

cnt = 0
tmp = ""
for elem in s:
  if "A" == elem:
    tmp += elem
  elif "B" == elem and tmp != "":
    if tmp[-1] == "A":
	    tmp += elem
  elif "C" == elem and tmp != "":
    if tmp[-1] == "B":
    	cnt += 1
    	tmp = ""
print(cnt)

Failing test case input:
33
BDBACBCBCBCBABBCBCABACCBABCBACCBA

Expected output:
1


Actual output:
3


Fixed submission (verdict: Accepted):
n = int(input())
s = input()

cnt = 0
tmp = ""
for elem in s:
  if "A" == elem:
    tmp += elem
  elif "B" == elem and tmp != "":
    if tmp[-1] == "A":
	    tmp += elem
    else:
      	tmp = ""
  elif "C" == elem and tmp != "":
    if tmp[-1] == "B":
    	cnt += 1
    tmp = ""
  else:
    tmp = ""
print(cnt)

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
S=input()
L=''
ans=0
for s in S:
    if s=='A' and L=='':
        L += s
    elif s=='B' and L=='A':
        L += s
    elif s=='C' and L=='AB':
        ans += 1
        L='' 
    else:
        L=''
print(ans)

Failing test case input:
33
ABBCABCBCBCACBACBCBAABCDCCBBCABCA

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
n=int(input())
S=input()
L=''
ans=0
for s in S:
    if s=='A':
        L = s 
    elif s=='B' and L=='A':
        L += s
    elif s=='C' and L=='AB':
        ans += 1
        L='' 
    else:
        L=''
print(ans)

Problem: p02812
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
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)

Failing test case input:
10
ZABCCB@BDQ

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
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)
Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = input()


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

print(num)


Failing test case input:
33
ABBCABCBABCACBACBCBCABCBCBDBCABCB

Expected output:
4


Actual output:
ABB
BBC
BCA
CAB
ABC
BCB
CBA
BAB
ABC
BCA
CAC
ACB
CBA
BAC
ACB
CBC
BCB
CBC
BCA
CAB
ABC
BCB
CBC
BCB
CBD
BDB
DBC
BCA
CAB
ABC
BCB
4


Fixed submission (verdict: Accepted):
N = int(input())
S = input()


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

print(num)

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = input()
inp = input()

sum = 0
order = 0

for c in inp:
  if ord(c) == ord('A'):
    order = 1
  elif ord(c) == ord('A') + order:
    order = (order + 1) % 3
    sum += max(0, order - 1)
  else:
    order = 0
print(sum)

Failing test case input:
33
ABBCABCBABCACBACBCBBABCBCBDBCABCB

Expected output:
4


Actual output:
5


Fixed submission (verdict: Accepted):
n = input()
inp = input()

sum = 0
order = 0

for c in inp:
  if ord(c) == ord('A'):
    order = 1
  elif ord(c) == ord('A') + order:
    order += 1
    if order == 3:
      order = 0
      sum += 1
  else:
    order = 0
print(sum)

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)        

Failing test case input:
10
ZABCCB@CDQ

Expected output:
1


Actual output:
1, 0

Fixed submission (verdict: Accepted):
M=int(input())
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(ans)

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = input()

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

Failing test case input:
19
OGIRHSEWOFRFNETENPF

Expected output:
0


Actual output:
OGI
GIR
IRH
RHS
HSE
SEW
EWO
WOF
OFR
FRF
RFN
FNE
NET
ETE
TEN
ENP
NPF
0


Fixed submission (verdict: Accepted):
n = int(input())
s = input()

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

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = list(str(input()))
ans = s.count('ABC')
print(ans)

Failing test case input:
10
ZABCDBABCQ

Expected output:
2

Actual output:
0


Fixed submission (verdict: Accepted):
n = int(input())
s = input()
ans = s.count('ABC')
print(ans)

Problem: p02812
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
print(input().count("ABC"))

Failing test case input:
33
ABBAABCCCCCADBBDBBAAABCDBDBCDBBCA

Expected output:
2


Actual output:
0


Fixed submission (verdict: Accepted):
input();print(input().count("ABC"))
Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = input()
tmp_c = 0
count = 0
for i in range(N):
    if tmp_c == 0 and S[i]=="A":
        tmp_c = tmp_c + 1
    elif tmp_c == 1 and S[i]=="B":
        tmp_c = tmp_c + 1
    elif tmp_c == 1:
        tmp_c = 0
    elif tmp_c == 2 and S[i]=="C":
        count = count + 1
        tmp_c = 0
    elif tmp_c == 2:
        tmp_c = 0
print(count)
    



Failing test case input:
33
ABBAABCCCCCADBBDBBAAABCDCDBCDBBCA

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
N = int(input())
S = input()
tmp_c = 0
count = 0
for i in range(N):
    if tmp_c == 0 and S[i]=="A":
        tmp_c = tmp_c + 1
    elif tmp_c == 1 and S[i]=="B":
        tmp_c = tmp_c + 1
    elif tmp_c == 1 and S[i]=="A":
        tmp_c = 1
    elif tmp_c == 1:
        tmp_c = 0
    elif tmp_c == 2 and S[i]=="C":
        count = count + 1
        tmp_c = 0
    elif tmp_c == 2 and S[i]=="A":
        tmp_c = 1
    elif tmp_c == 2:
        tmp_c = 0
print(count)

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
33
ABBAABCCCCCADBBDBBAAABCDCDBCDBBCA

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
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
    elif s_ == "A":
        tmp = "A"
    else:
        tmp = None
print(cnt)

Problem: p02812
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
s = input()

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


Failing test case input:
33
BDBACBCBCBCBABBCBCABACCBABCBACCBA

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
n = int(input())
s = input()

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

Problem: p02812
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n = int(input()) 
s = input()
print(s.count('abc'))

Failing test case input:
33
ACBACCBDBDCBAABCBDBBCACCCCCBABBBA

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
n = int(input()) 
s = input()
print(s.count('ABC'))

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
s=input()
s.replace('ABC','a')
print(s.count('a'))

Failing test case input:
33
BDBACBCBCBCBABBCBCABACCBABCBACCBA

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
n=int(input())
s=input()
t=s.replace('ABC','a')
print(t.count('a'))
Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = input()
c=0
for i in range(n - 2):
    print(s[i:i + 3])
    if s[i:i + 3] == 'ABC':
        c += 1
print(c)

Failing test case input:
19
FGIFHROWEORENEUFNOR

Expected output:
0


Actual output:
FGI
GIF
IFH
FHR
HRO
ROW
OWE
WEO
EOR
ORE
REN
ENE
NEU
EUF
UFN
FNO
NOR
0


Fixed submission (verdict: Accepted):
n = int(input())
s = input()
c=0
for i in range(n - 2):
    if s[i:i + 3] == 'ABC':
        c += 1
print(c)

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from sys import stdin

lines = stdin.readlines()

n = int(lines[0].rstrip())
s = str(lines[1].rstrip())

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

Failing test case input:
10
CDAAPBBBAY

Expected output:
0


Actual output:
0
1
2
3
4
5
6
7
0


Fixed submission (verdict: Accepted):
from sys import stdin

lines = stdin.readlines()

n = int(lines[0].rstrip())
s = str(lines[1].rstrip())

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

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = [i for i in range(N)]
cnt = 0

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

print(cnt)

Failing test case input:
33
ABBCABCCCBCACBACBCBAABCDCCBBCABCA

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):
N = int(input())
S = input()
S = [i for i in S]
cnt = 0

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

print(cnt)

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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()


Failing test case input:
10
BDBAPBCBAY

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
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()
Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
cha = input()
if "ABC" in cha:
    print(cha.count("ABC"))

Failing test case input:
19
OGIRHROWEFRENEUFNOF

Expected output:
0


Actual output:

Fixed submission (verdict: Accepted):
N = int(input())
cha = input()
print(cha.count("ABC"))

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = input()
flag = 0
for i in range(n-1):
    if i == n-3:
        break
    if s[i] == 'A':
        if s[i+1] == 'B':
            if s[i+2] == 'C':
                flag =+ 1
print(flag)

Failing test case input:
33
ABBCABCBABCACBACBCBCABCDCCBBCABCB

Expected output:
4


Actual output:
1


Fixed submission (verdict: Accepted):
n = int(input())
s = input()
flag = 0
for i in range(n-1):
    if i == n-2:
        break
    if s[i] == 'A':
        if s[i+1] == 'B':
            if s[i+2] == 'C':
                flag += 1
print(flag)

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = input()

flag = 0
cnt = 0
for i in s:
    if i == "A" and flag == 0:
        flag = 1
    
    elif i == "B" and flag == 1:
        flag = 2
    
    elif i == "C" and flag == 2:
        cnt += 1
        flag = 0
    
    else:
        flag = 0

print(cnt)

Failing test case input:
33
ABBCABCCCBCACBACBCBAABCDBCBBCABCA

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
n = int(input())
s = input()

flag = 0
cnt = 0
for i in s:
    if i == "A" and (flag == 0 or flag == 1):
        flag = 1
    
    elif i == "B" and flag == 1:
        flag = 2
    
    elif i == "C" and flag == 2:
        cnt += 1
        flag = 0
    
    else:
        flag = 0

print(cnt)

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
s = input()
cnt = 0
for i in range(N-2):
  print(s[i:i+3])
  if s[i:i+3] =="ABC":
    cnt += 1
print(cnt)

Failing test case input:
10
DBCCBNAAZB

Expected output:
0


Actual output:
DBC
BCC
CCB
CBN
BNA
NAA
AAZ
AZB
0


Fixed submission (verdict: Accepted):
N = int(input())
s = input()
cnt = 0
for i in range(N-2):
  if s[i:i+3] =="ABC":
    cnt += 1
print(cnt)

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    N = int(input())
    S = str(input())
    print (S)
    if 'ABC' in S :
        C = S.split('ABC')
        
        print (len(C)-1)


if __name__ == '__main__':
    main()

Failing test case input:
33
ABCCABCBABCCABACBCBBABCBCBCBCABCB

Expected output:
5

Actual output:
ABCCABCBABCCABACBCBBABCBCBCBCABCB
5


Fixed submission (verdict: Accepted):
def main():
    N = int(input())
    S = str(input())
    
    if 'ABC' in S :
        C = S.split('ABC')
        
        print (str(len(C)-1))
    else :
        print ('0')


if __name__ == '__main__':
    main()

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = input()

print(s.count('abc'))

Failing test case input:
33
ACBACCBDBDCBAABCBDBBCACCCCCBABBBA

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
N = int(input())
S = input()
 
print(S.count('ABC'))
Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = input()

ans = 0

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

Failing test case input:
33
ABBCABCCCCCACBACBCBAABCDBDBBCABCA

Expected output:
3


Actual output:
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
3


Fixed submission (verdict: Accepted):
N = int(input())
S = input()

ans = 0

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

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = input()

ret = 0
cursor = 0
for s in S:
  if cursor == 0:
    if s == 'A':
      cursor = 1
  elif cursor == 1:
    if s == 'B':
      cursor = 2
    else:
      cursor = 0
  else:
    if s == 'C':
      ret += 1
      cursor = 0
    else:
      cursor = 0
      
print(ret)

Failing test case input:
33
ABBAABCCCCCADBBDBBAAABCDBDBCDBBCA

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
N = int(input())
S = input()

ret = 0
cursor = 0
for s in S:
  if cursor == 0:
    if s == 'A':
      cursor = 1
  elif cursor == 1:
    if s == 'B':
      cursor = 2
    elif s == 'A':
      cursor = 1
    else:
      cursor = 0
  else:
    if s == 'C':
      ret += 1
      cursor = 0
    elif s == 'A':
      cursor = 1
    else:
      cursor = 0
      
print(ret)

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
t=input()
ans=0
tmp=""
for i in t:
  if i=="A":
    if tmp=="":
    	tmp+="A"
    else:
      	tmp=""
  elif i=="B":
    if tmp=="A":
      tmp+="B"
    else:
      tmp=""
  elif i=="C":
    if tmp=="AB":
      ans+=1
      tmp=""
    else:
      tmp=""
  else:
    tmp=""
print(ans)

Failing test case input:
33
ABBAABCCCCDADBBDBBAAABCDCDBCDCBCA

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
n=int(input())
t=input()
ans=0
tmp=""
for i in t:
  if i=="A":
    tmp="A"
  elif i=="B":
    if tmp=="A":
      tmp+="B"
    else:
      tmp=""
  elif i=="C":
    if tmp=="AB":
      ans+=1
    tmp=""
  else:
    tmp=""
print(ans)

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
33
ABBCABCBCBCACBACBCBAABCDCCBBCABCA

Expected output:
3


Actual output:
1


Fixed submission (verdict: Accepted):
N = int(input())
S = str(input())

ans = 0

for i in range(len(S) - 2):
    
    if S[i:i+3] == "ABC":
        ans += 1
    else:
        pass
print(ans)
Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = list(str(input()))

tmp = 0
count = 0
for i in S:
  if i == "A":
    tmp = 1
  elif i == "B" and tmp == 1:
    tmp = 2
  elif i == "C" and tmp == 2:
    count += 1
  else:
    tmp = 0
print(count)

Failing test case input:
33
ABBCABCCCBCACBACBCBAABCDCCBBCABCA

Expected output:
3


Actual output:
5


Fixed submission (verdict: Accepted):
N = int(input())
S = list(str(input()))

tmp = 0
count = 0
for i in S:
  if i == "A":
    tmp = 1
  elif i == "B" and tmp == 1:
    tmp = 2
  elif i == "C" and tmp == 2:
    count += 1
    tmp = 0
  else:
    tmp = 0
print(count)

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = input()

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

Failing test case input:
19
SOREUENEROEWONHFIGE

Expected output:
0


Actual output:
SOREUENEROEWONHFIGE
0


Fixed submission (verdict: Accepted):
N = int(input())
S = input()

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

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
l = int(input())
 
word = input()
 
counter = 0
for i in range(len(word)):
  if len(word[i:]) >= 3:
    print(word[i:i+3])
    if word[i:i+3] == 'abc':
      counter += 1
      
print(counter)

Failing test case input:
10
DBNCBCAAZB

Expected output:
0


Actual output:
DBN
BNC
NCB
CBC
BCA
CAA
AAZ
AZB
0


Fixed submission (verdict: Accepted):
l = int(input())
 
word = input()
 
counter = 0
for i in range(len(word)-2):
  if word[i:i+3] == 'ABC':
    counter += 1
      
print(counter)

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


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

Failing test case input:
19
OGIRHSOWEFRENEUFNOF

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):

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

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

Problem: p02812
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = input()
s = input()
count = 0
for i in range(1, int(n)-1):
    print(s[i-1] + s[i] + s[i+1])
    if s[i-1] + s[i] + s[i+1] == "ABC":
        count = count + 1
print(count)

Failing test case input:
10
BZAANBCCBD

Expected output:
0


Actual output:
BZA
ZAA
AAN
ANB
NBC
BCC
CCB
CBD
0


Fixed submission (verdict: Accepted):
n = input()
s = input()
count = 0
for i in range(1, int(n)-1):
    if s[i-1] + s[i] + s[i+1] == "ABC":
        count = count + 1
print(count)