Doubled

AtCoder
IDabc196_c
Time2000ms
Memory256MB
Difficulty
Given is an integer $N$. How many integers $x$ between $1$ and $N$ (inclusive) satisfy the following condition? * The decimal representation (without leading zeros) of $x$ has an even number of digits, and its first and second halves are equal as strings. ## Constraints * $N$ is an integer. * $1 ≤ N < 10^{12}$ ## Input Input is given from Standard Input in the following format: $N$ [samples]
Samples
Input #1
33
Output #1
3

Three numbers $11$, $22$, and $33$ satisfy the condition.
Input #2
1333
Output #2
13

For example, the decimal representation of $1313$ has four digits, and its first and second halves are both $13$, so $1313$ satisfies the condition.
Input #3
10000000
Output #3
999
API Response (JSON)
{
  "problem": {
    "name": "Doubled",
    "description": {
      "content": "Given is an integer $N$.   How many integers $x$ between $1$ and $N$ (inclusive) satisfy the following condition? *   The decimal representation (without leading zeros) of $x$ has an even number of d",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc196_c"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Given is an integer $N$.  \nHow many integers $x$ between $1$ and $N$ (inclusive) satisfy the following condition?\n\n*   The decimal representation (without leading zeros) of $x$ has an even number of d...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments