Unbalanced

AtCoder
IDarc059_b
Time2000ms
Memory256MB
Difficulty
Given a string $t$, we will call it _unbalanced_ if and only if the length of $t$ is at least $2$, and more than half of the letters in $t$ are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` nor `a` is. You are given a string $s$ consisting of lowercase letters. Determine if there exists a (contiguous) substring of $s$ that is unbalanced. If the answer is positive, show a position where such a substring occurs in $s$. ## Constraints * $2 ≦ |s| ≦ 10^5$ * $s$ consists of lowercase letters. ## Input The input is given from Standard Input in the following format: $s$ ## Partial Score * $200$ points will be awarded for passing the test set satisfying $2 ≦ N ≦ 100$. [samples]
Samples
Input #1
needed
Output #1
2 5

The string $s_2 s_3 s_4 s_5$ $=$ `eede` is unbalanced. There are also other unbalanced substrings. For example, the output `2 6` will also be accepted.
Input #2
atcoder
Output #2
\-1 -1

The string `atcoder` contains no unbalanced substring.
API Response (JSON)
{
  "problem": {
    "name": "Unbalanced",
    "description": {
      "content": "Given a string $t$, we will call it _unbalanced_ if and only if the length of $t$ is at least $2$, and more than half of the letters in $t$ are the same. For example, both `voodoo` and `melee` are unb",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "arc059_b"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Given a string $t$, we will call it _unbalanced_ if and only if the length of $t$ is at least $2$, and more than half of the letters in $t$ are the same. For example, both `voodoo` and `melee` are unb...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments