Count ABC

AtCoder
IDabc150_b
Time2000ms
Memory256MB
Difficulty
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$ [samples]
Samples
Input #1
10
ZABCDBABCQ
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.
Input #2
19
THREEONEFOURONEFIVE
Output #2
0

No contiguous subsequences of $S$ are equal to `ABC`.
Input #3
33
ABCCABCBABCCABACBCBBABCBCBCBCABCB
Output #3
5
API Response (JSON)
{
  "problem": {
    "name": "Count ABC",
    "description": {
      "content": "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)?",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc150_b"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "We have a string $S$ of length $N$ consisting of uppercase English letters.\nHow many times does `ABC` occur in $S$ as contiguous subsequences (see Sample Inputs and Outputs)?\n\n## Constraints\n\n*   $3 \\...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments