098. It's More Fun To Compute

Codeforces
IDCF10269098
Time1000ms
Memory256MB
Difficulty
English · Original
Formal · Original
It's More Fun To Compute You are trying to discover that it's more fun to compute, and you're doing so by evaluating long strings of text. You define the _fun-ness_ of a string to be the amount of characters in the string that are equal to "f", "u", and "n". You can perform cyclic shifts on the string an infinite number of times. When you cyclically shift the string, each character changes into the one after it, so any "a" characters become "b", "b" becomes "c", etc. "z" characters turn into "a" in a cyclic shift. Given that you can perform an infinite number of cyclic shifts on the input string, find the maximum _fun-ness_ of the string. The only line of input contains a single string $s$, consisting of only lowercase a-z characters and spaces. (When you perform a cyclic shift on the string, nothing happens to the spaces). Output a single positive integer $n$: the maximum possible fun-ness of the string, as described above. ## Input The only line of input contains a single string $s$, consisting of only lowercase a-z characters and spaces. (When you perform a cyclic shift on the string, nothing happens to the spaces). ## Output Output a single positive integer $n$: the maximum possible fun-ness of the string, as described above. [samples]
**Definitions** Let $ s \in \Sigma^* $ be the input string, where $ \Sigma = \{a, b, \dots, z\} \cup \{\text{space}\} $. Let $ F = \{f, u, n\} $ be the set of "fun" characters. Let $ \sigma^k(s) $ denote the string obtained by applying $ k $ cyclic shifts to $ s $, where each letter $ c \in \{a, \dots, z\} $ is mapped to $ (c - a + k) \mod 26 + a $, and spaces remain unchanged. **Constraints** - $ s $ contains only lowercase English letters and spaces. - $ k \in \mathbb{Z}_{\geq 0} $, with $ 0 \leq k < 26 $ (since shifts are modulo 26). **Objective** Compute: $$ \max_{k=0}^{25} \left| \left\{ i \mid \sigma^k(s)_i \in F \right\} \right| $$
API Response (JSON)
{
  "problem": {
    "name": "098. It's More Fun To Compute",
    "description": {
      "content": "It's More Fun To Compute You are trying to discover that it's more fun to compute, and you're doing so by evaluating long strings of text. You define the _fun-ness_ of a string to be the amount of ch",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10269098"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "It's More Fun To Compute\n\nYou are trying to discover that it's more fun to compute, and you're doing so by evaluating long strings of text. You define the _fun-ness_ of a string to be the amount of ch...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ s \\in \\Sigma^* $ be the input string, where $ \\Sigma = \\{a, b, \\dots, z\\} \\cup \\{\\text{space}\\} $.  \nLet $ F = \\{f, u, n\\} $ be the set of \"fun\" characters.  \nLet $ \\sigma^k(s)...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments