#K60572. Count Occurrences of 'ABC' Substrings
Count Occurrences of 'ABC' Substrings
Count Occurrences of 'ABC' Substrings
You are given a string s and you need to count the number of occurrences of the substring ABC
in s. The substring ABC
must appear as three contiguous characters.
More formally, if we denote a contiguous substring of s of length 3 starting at index i as \( s[i:i+3] \), you need to count the number of indices \( i \) such that \( s[i:i+3] = \textbf{ABC} \).
Note: The search for the substring is case-sensitive, and the input string may contain any valid characters.
inputFormat
A single line containing the string s. The string is given via standard input (stdin).
outputFormat
An integer representing the number of times the substring ABC
appears in the string s. The result should be printed to standard output (stdout).
AAAABBBCCCC
0