201081: [AtCoder]ARC108 B - Abbreviate Fox
Memory Limit:1024 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Score : $400$ points
Problem Statement
Given is a string $S$ of length $N$ consisting of lowercase English letters.
Snuke can do this operation any number of times: remove fox
occurring as a substring from $s$ and concatenate the remaining parts of $s$.
What is the minimum possible length of $s$ after some number of operations by Snuke?
Constraints
- $1 \leq N \leq 2 \times 10^{5}$
- $s$ is a string of length $N$ consisting of lowercase English letters.
Input
Input is given from Standard Input in the following format:
$N$ $s$
Print the minimum possible length of $s$ after some number of operations by Snuke.
Sample Input 1
6 icefox
Sample Output 1
3
- By removing the
fox
at the end oficefox
, we can turn $s$ intoice
.
Sample Input 2
7 firebox
Sample Output 2
7
fox
does not occur as a substring.
Sample Input 3
48 ffoxoxuvgjyzmehmopfohrupffoxoxfofofoxffoxoxejffo
Sample Output 3
27