#P2110. 欢总喊楼记

欢总喊楼记

Description

The girl gives two integers LL and RR, and she wants Huan-zong to count how many integers XX satisfy:

  • LXRL \le X \le R,
  • The most significant and least significant decimal digits of XX are equal.

For example (ignoring the restriction LXRL \le X \le R), 22, 101101, 329873329873 qualify, whereas 2323 and 45674567 do not.

Children, Huan-zong’s happiness in his next life depends on your help!

Input Format

One line containing two integers LL and RR.

Output Format

One line with a single integer, the number of XX that satisfy the property.

2 47
12

Hint

Constraints:

For 50%50\% of the testdata, 1LR1061 \le L \le R \le 10^6.

For 100%100\% of the testdata, 1LR10181 \le L \le R \le 10^{18}.

Translated by ChatGPT 5