Count how many times the word "Pinkie Pie" appears after replacing each occurrence of "pink" with "pinkie" in a given string.
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.
Find the number of occurrences of pinkie pie that can be obtained from the given string according to the rule above.
s.pinkie pie after applying the transformation rule.1 <= |s| <= $10^{5}$s contains only lowercase English lettersExample 1
Input
pink
Output
1
Explanation
The string can be transformed into pinkie pie, so there is exactly one occurrence.
Premium problem context
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.