P6754 [BalticOI 2013] Palindrome-Free Numbers (Day1)

Description

We define a palindrome string as a digit string that reads the same forward and backward. If a digit string has a substring of length greater than $1$ that is also a palindrome string, then we also define this digit string as a palindrome string. As the name suggests, a digit string that is not a palindrome string is a palindrome-free string. Given $a, b$, find how many digit strings in the interval $[a, b]$ are palindrome-free strings.

Input Format

One line with two integers $a, b$ representing this interval.

Output Format

One line with one integer representing the answer.

Explanation/Hint

#### Constraints For $100\%$ of the testdata, $0 \le a \le b \le 10^{18}$. For $25\%$ of the testdata, $b - a \le 10^5$. #### Notes Translated from [BalticOI 2013 Day1 B Palindrome-Free Numbers](https://boi.cses.fi/files/boi2013_day1.pdf)。 Translated by ChatGPT 5