Abbreviate Fox

AtCoder
IDarc108_b
Time2000ms
Memory256MB
Difficulty
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$ [samples]
Samples
Input #1
6
icefox
Output #1
3

*   By removing the `fox` at the end of `icefox`, we can turn $s$ into `ice`.
Input #2
7
firebox
Output #2
7

*   `fox` does not occur as a substring.
Input #3
48
ffoxoxuvgjyzmehmopfohrupffoxoxfofofoxffoxoxejffo
Output #3
27
API Response (JSON)
{
  "problem": {
    "name": "Abbreviate Fox",
    "description": {
      "content": "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 remaini",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "arc108_b"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "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 remaini...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments