116. Diverse String

Codeforces
IDCF10269116
Time1000ms
Memory256MB
Difficulty
English · Original
Formal · Original
You consider a string to be a _diverse string_ if every pair of adjacent characters are different. For example _coderams_ is a diverse string, while _hello_ is not. Given a string, figure out whether or not it is a diverse string. The only line of input contains a single string, not containing spaces. If the string is a diverse string, output "YES" (no quotes). Otherwise, output "NO" (no quotes). ## Input The only line of input contains a single string, not containing spaces. ## Output If the string is a diverse string, output "YES" (no quotes). Otherwise, output "NO" (no quotes). [samples]
**Definitions** Let $ s = s_1 s_2 \dots s_n $ be a string of length $ n \geq 1 $, where each $ s_i $ is a character. **Constraints** $ n \geq 1 $, and $ s_i \in \Sigma $ for some alphabet $ \Sigma $, with no spaces in $ s $. **Objective** Determine whether $ s $ is a *diverse string*, i.e., $$ \forall i \in \{1, 2, \dots, n-1\}, \quad s_i \neq s_{i+1} $$ If true, output "YES"; otherwise, output "NO".
API Response (JSON)
{
  "problem": {
    "name": "116. Diverse String",
    "description": {
      "content": "You consider a string to be a _diverse string_ if every pair of adjacent characters are different. For example _coderams_ is a diverse string, while _hello_ is not. Given a string, figure out whether",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10269116"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "You consider a string to be a _diverse string_ if every pair of adjacent characters are different. For example _coderams_ is a diverse string, while _hello_ is not.\n\nGiven a string, figure out whether...",
      "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 $ is a character.\n\n**Constraints**  \n$ n \\geq 1 $, and $ s_i \\in \\Sigma $ for some alphabet $ \\Sigm...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments