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

[BalticOI 2013] Palindrome-Free Numbers (Day1)

Problem 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 11 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,ba, b, find how many digit strings in the interval [a,b][a, b] are palindrome-free strings.

Input Format

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

Output Format

One line with one integer representing the answer.

123 321
153
123456789 987654321
167386971

Hint

Constraints

For 100%100\% of the testdata, 0ab10180 \le a \le b \le 10^{18}.
For 25%25\% of the testdata, ba105b - a \le 10^5.

Notes

Translated from BalticOI 2013 Day1 B Palindrome-Free Numbers

Translated by ChatGPT 5