101962: [AtCoder]ABC196 C - Doubled

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Score : $300$ points

Problem Statement

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$

Output

Print the answer.


Sample Input 1

33

Sample Output 1

3

Three numbers $11$, $22$, and $33$ satisfy the condition.


Sample Input 2

1333

Sample 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.


Sample Input 3

10000000

Sample Output 3

999

Input

题意翻译

给出一个整数 $ N $。 在 $ 1 $ 到 $ N $ 中满足以下条件的整数 $ x $ 有多少个? * $ x $ 的十进制表示(不带前导零)有偶数位数字,并且它的前半部分和后半部分作为字符串相等。

加入题单

上一题 下一题 算法标签: