ARC108B - Abbreviate Fox
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
Time Limit: 2 sec / Memory Limit: 1024 MB
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≤N≤2×105
- 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
军训训练赛1
- Status
- Done
- Rule
- IOI
- Problem
- 7
- Start at
- 2023-8-20 8:00
- End at
- 2023-8-20 11:00
- Duration
- 3 hour(s)
- Host
- Partic.
- 12