Count how many times the word "Pinkie Pie" appears after replacing each occurrence of "pink" with "pinkie" in a given string.
Problem
You are given a string consisting of lowercase English letters. In the string, every occurrence of the substring pink can be replaced by pinkie. Your task is to determine how many times the string pinkie pie appears after all such replacements are performed.
A valid occurrence is counted whenever the substring pinkie pie appears in the final transformed text. Replacements may create new matches that should also be considered as part of the final result.
Task
Find the number of occurrences of pinkie pie that can be obtained from the given string according to the rule above.
Input Format
- A single line containing a string
s. - The string contains only lowercase English letters.
Output Format
- Print one integer: the number of occurrences of
pinkie pieafter applying the transformation rule.
Constraints
1 <= |s| <= $10^{5}$scontains only lowercase English letters- The transformation is interpreted on the full string, not by overlapping partial replacements
Example 1
Input
pink
Output
1
Explanation
The string can be transformed into pinkie pie, so there is exactly one occurrence.
Premium problem context
Unlock deeper context for this problem
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.