410198: GYM103973 H Substrings
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
H. Substringstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output
Walk Alone has a string, and he wants you to count the number of consecutive 'fyt' in the string.
For example, the answer to 'ffyt' is $$$1$$$ since the second to the fourth character forms a consecutive 'fyt', while 'ffyytt' has no 'fyt' as its substring.
InputThe first line contains an integer $$$n\ (1 \leq n \leq 10^6)$$$, indicating the length of the string.
The second line contains a single string consisting of three characters 'f', 'y', and 't', representing the string.
OutputOutput a single integer indicating the number of consecutive 'fyt' in the input string.
ExamplesInput6 fytfytOutput
2Input
9 fytffyyttOutput
1