Under construction

Still being built. Things may change

Journey Through Worlds

Interview

Time limit2sMemory limit1024 MB

Summary
Count the repdigit numbers (such as 11, 222, or 9999) between l and r, where l and r can be as large as 10^18.
Level

Easy2 of 10

Topics
Math, Implementation
Solved
No attempts yet

Problem

Doctor Strange recently gained his powers, but he immediately decided to organize everything. He got access to infinitely many, yet countably many, alternate realities, and he decided to number all of them. Once he finished, he looked at his work and noticed an interesting property of his numbering: all of his favorite alternate realities have numbers made of identical digits, and conversely, every number made of identical digits corresponds to one of his favorite realities.

Of course, Doctor Strange cannot look at all realities at once, so right now he is looking at the realities numbered ll, l+1l+1, l+2l+2, …\ldots, rr. He became curious: how many of his favorite realities is he seeing right now? He has a lot to do and no time to count it himself, so he asked you to help him with this task.

Input

The only line contains two numbers ll, rr, the numbers of the outermost alternate realities that Doctor Strange sees (1≤l≤r≤10181 \le l \le r \le 10^{18}).

Output

Print one line with the number of Doctor Strange's favorite alternate realities that he sees.

Hint

In the first example, all numbers consist of one digit, so they all correspond to favorite realities.

In the second example, the suitable numbers are 11, 22, 33, 44, 55, 66, 77, 88, and 99, which makes exactly 9 of them.

Examples2

  1. Example 1

    Input
    4 7
    
    Expected output
    4
    
  2. Example 2

    Input
    10 100
    
    Expected output
    9