141. Majestic Strings

Codeforces
IDCF10269141
Time1000ms
Memory256MB
Difficulty
English · Original
Formal · Original
You define a string to be a _majestic string_ if each successive character in the string comes one character later in the alphabet than the one before it. For example, _bcdef_ is a majestic string, and so is _xyz_, but _acd_ is not a majestic string. The characters also wrap from z to a, so _yzab_ is a majestic string. Given a string $s$, figure out whether or not it is a majestic string, using the rule described above. The only line of input contains a single string $s$. If $s$ is a majestic string, output "YES" (no quotes). Otherwise, output "NO". ## Input The only line of input contains a single string $s$. ## Output If $s$ is a majestic string, output "YES" (no quotes). Otherwise, output "NO". [samples]
**Definitions** Let $ s = s_1 s_2 \dots s_n $ be a string of length $ n \geq 1 $, where each $ s_i \in \{a, b, \dots, z\} $. Define the alphabetical position function $ f: \{a, b, \dots, z\} \to \mathbb{Z} $ by $ f(c) = c - 'a' $, so $ f(a) = 0, f(b) = 1, \dots, f(z) = 25 $. **Constraints** $ 1 \leq n \leq 26 $ **Objective** Determine whether for all $ i \in \{1, 2, \dots, n-1\} $: $$ f(s_{i+1}) \equiv f(s_i) + 1 \pmod{26} $$ If true, output "YES"; otherwise, output "NO".
API Response (JSON)
{
  "problem": {
    "name": "141. Majestic Strings",
    "description": {
      "content": "You define a string to be a _majestic string_ if each successive character in the string comes one character later in the alphabet than the one before it. For example, _bcdef_ is a majestic string, an",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10269141"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "You define a string to be a _majestic string_ if each successive character in the string comes one character later in the alphabet than the one before it. For example, _bcdef_ is a majestic string, an...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ s = s_1 s_2 \\dots s_n $ be a string of length $ n \\geq 1 $, where each $ s_i \\in \\{a, b, \\dots, z\\} $.  \nDefine the alphabetical position function $ f: \\{a, b, \\dots, z\\} \\to \\...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments