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: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
words = input()
cnt = words.count("ABC")
print(cnt)

Submission status: Accepted

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(s.count("ABC"))

Submission status: Accepted

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-2):
        if s[i:i+3]=='ABC':
            cnt+=1
    print(cnt)
resolve()

Submission status: Accepted

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: Accepted

Solution code:
n=int(input())

s=str(input())

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

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: Accepted

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

print(s.count('ABC'))

Submission status: Accepted

Solution code:
n = int(input())
s = input()
list = []
count = 0
for i in range(0, len(s)-2):
    list.append(s[i:i+3])
for i in list:
    if i=='ABC':
        count +=1
print(count)

Submission status: Accepted

Solution code:
def solve():
    N = int(input())
    S = input()
    return S.count("ABC")

print(solve())

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(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: Accepted

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

print (S.count("ABC"))

Submission status: Accepted

Solution code:

n=int(input())
s=input()
kazu=s.count('ABC')
print(kazu)

Submission status: Accepted

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

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

Submission status: Accepted

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: Accepted

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

Submission status: Accepted

Solution code:

def main():
    _ = int(input())
    S = input()
    print(S.count('ABC'))


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

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

print(s.count("ABC"))

Submission status: Accepted

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

Submission status: Accepted

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

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

print(cnt)

Submission status: Accepted

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: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
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)
    # print(current_index, s[i:])
  if index != current_index:
    counter += 1
    index = current_index
print(counter)

Submission status: Accepted

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

print(S.count('ABC'))

Submission status: Accepted

Solution code:
N = int(input())

S = input()

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

print(s.count('ABC'))

Submission status: Accepted

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

print(len(S.split("ABC")) - 1)

Submission status: Accepted

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

Submission status: Accepted

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

    print(s.count("ABC"))


main()

Submission status: Accepted

Solution code:
_=int(input())
S=input()
print(S.count("ABC"))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    input()
    t = input()
    print(t.count('ABC'))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
x = int(input())
y = input()

print(y.count('ABC'))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

def main():
    N, S = map(str, open(0).read().split())
    print(S.count('ABC'))


main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(count)

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
  N=int(input())
  S=input()
  scount=0
  for i in range(N-1):
    for j in range(N):
      S_i=S[i:j+1]
      if(S_i=='ABC'):
        scount=scount+1
  print(scount)
  
if __name__=='__main__':
  main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

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

print(S.count("ABC"))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
n = int(sys.stdin.readline())
s = sys.stdin.readline().strip()
print(s.count('ABC'))

Submission status: Accepted

Solution code:
import sys
n = int(sys.stdin.readline())
s = sys.stdin.readline().strip()
i = 0
cnt = 0
while i <= n -3:
  if s[i:i+3] == 'ABC':
    cnt += 1
  i += 1
print(cnt)

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

Solution code:
#!/usr/bin/python3
# -*- coding: utf-8 -*-

# N = int(input())
# N = int(input().split())
# N, K = [int(x) for x in input().split()]

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

c = 0

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

print(c)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(s.count('ABC'))

Submission status: Accepted

Solution code:

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

print(s.count("ABC"))

Submission status: Accepted

Solution code:
N = input()
S = input()
a = "ABC"

print(S.count(a))

Submission status: Accepted

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

Submission status: Accepted

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

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

print(cnt)

Submission status: Accepted

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: Accepted

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

count = 0

for i in range(N-2):
    letter1 = S[i]
    letter2 = S[i+1]
    letter3 = S[i+2]

    if (letter1 == 'A') and (letter2 == 'B') and (letter3 == 'C'):
        count += 1

print(count)

Submission status: Accepted

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

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

ans = 0

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

Submission status: Accepted

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

print(cnt)

Submission status: Accepted

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

cnt = s.count("ABC")

print(cnt)

Submission status: Accepted

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: Accepted

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

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

print(count)

Submission status: Accepted

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

ans = 0;

for i in range(n):
  three = s[i:i+3];
  ans += int(three == "ABC");

print(ans);

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
from functools import reduce
import itertools
import numpy as np

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

if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
num = int(input())
words = input()

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

print(count)

Submission status: Accepted

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: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

A = 0

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7


N = ri()
S = rs()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(cut)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC 150: B – Count ABC
N = int(input())
print(input().count('ABC'))

Submission status: Accepted

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

import re

a = re.findall('ABC', S)
print(len(a))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
S = [i for i in input()] + [-1, -1]
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: Accepted

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

ans = S.count('ABC') 

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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-2):
    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: Accepted

Solution code:
from collections import deque, Counter as cnt
from collections import defaultdict as dd
from operator import itemgetter as ig
from bisect import bisect_right as bsr
from math import factorial, ceil, floor
import sys
sys.setrecursionlimit(1000000)

# お約束
args = None
INF = float("inf")
MOD = int(1e9 + 7)


def input(*ps):
    if type(ps[0]) is list:
        return [input(*ps[0][:-1]) for _ in range(ps[0][-1])]
    elif len(ps) == 1:
        return ps[0](next(args))
    else:
        return [p(next(args)) for p in ps]


def nlist(n, v):
    if not n:
        return [] if type(v) is list else v
    return [nlist(n[1:], v) for _ in range(n[0])]


def yesno(v, yes="Yes", no="No", upper=False):
    if upper:
        print([yes.upper(), no.upper()][not v])
    else:
        print([yes, no][not v])


def main():
    """エントリーポイント"""
    N, S = input(int, str)
    ans = 0
    for x in range(N - 2):
        if S[x:x + 3] == "ABC":
            ans += 1
    print(ans)


if __name__ == '__main__':
    args = iter(sys.stdin.read().split())
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

print(s.count('ABC'))

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys


def solve(N: int, S: str):
    result = 0
    for i in range(N - 2):
        if S[i : i + 3] == "ABC":
            result += 1

    print(result)

    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    solve(N, S)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

count = 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: Accepted

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

Submission status: Accepted

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: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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

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

print(ans)

Submission status: Accepted

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: Accepted

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

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

Submission status: Accepted

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

ans = 0

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

Submission status: Accepted

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

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

Submission status: Accepted

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

print(S.count("ABC"))

Submission status: Accepted

Solution code:
import math
import fractions
import sys
import itertools
import numpy as np
from collections import Counter
import datetime
#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))

def keta(N):
	return len(str(N))


def input_daytime(input_time):
	time,distance=input_time.split()
	t=time.split(":")
	se=str(t[-1]).split(".")
	dt1 = datetime.timedelta(hours=int(t[0]),minutes=int(t[1]),seconds=int(se[0]),milliseconds=int(se[1]))
	return dt1

n=input1()
s=str(input())
count=0
print(s.count("ABC"))

Submission status: Accepted

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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


print(ans)

Submission status: Accepted

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

Submission status: Accepted

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: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC150B - Count ABC

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: Accepted

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

Submission status: Accepted

Solution code:
def I(): return int(input())
def S(): return input()
N = I()
S = S()
print(S.count('ABC'))

Submission status: Accepted

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

Submission status: Accepted

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

    
if __name__ == '__main__':
    q2()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
S = input()
c = 0
for i in range(N-2):
  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: Accepted

Solution code:
import sys

N = int(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: Accepted

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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7


def main():
  N = int(input())
  S = input()
  ans = 0
  for i in range(N-2):
    if S[i]=='A' and S[i+1] == 'B' and S[i+2]=='C':
      ans += 1
  print(ans)
  
  
  
  
if __name__ == '__main__':
  main()

Submission status: Accepted

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

#https://atcoder.jp/contests/abc154/tasks/abc150_b

N = input()
S = input()

print(S.count("ABC"))

Submission status: Accepted

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

Submission status: Accepted

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

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

print(new_S.count("@"))

Submission status: Accepted

Solution code:
n = int(input())
s = input()
ans = 0
for x,y,z in zip(s,s[1:],s[2:]):
    if x == 'A' and y == 'B' and z == 'C':
        ans += 1
print(ans)

Submission status: Accepted

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

ans = 0

i = 0
while i < n-2:
  if ss[i] == "A" and ss[i + 1] == "B" and ss[i + 2] == "C":
    ans += 1
  i += 1
    
print(ans)

Submission status: Accepted

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


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

    print(s.count("ABC"))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N=int(input())
A=list(input())
cnt=0

for n in range(N):
    if n==N-1 or n==N-2:
        continue
    elif 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: Accepted

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

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

print(count)

Submission status: Accepted

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

def main():
     n = int(input())
     s = input()
     ans = 0

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

ans = S.replace("ABC",'',-1)
print((N-len(ans))//3)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
s = str(input())
part = 'ABC'
count = 0
for i in range(n):
  if (part in s) == False:
    break
  s = s.replace(part, "", 1)
  count += 1  
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

print(S.count('ABC'))

Submission status: Accepted

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

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

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

print(ans)

Submission status: Accepted

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

print(S.count("ABC"))

Submission status: Accepted

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