204A.md (1238B)
1 Source: https://codeforces.com/problemset/problem/204/A 2 3 A. Little Elephant and Interval 4 5 time limit per test 6 7 2 seconds 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 stdin 16 17 output 18 19 stdout 20 21 The Little Elephant very much loves sums on intervals. 22 23 This time he has a pair of integers *l* and *r* (*l* ≤ *r*). The Little Elephant has to find the number of such integers *x* (*l* ≤ *x* ≤ *r*), that the first digit of integer *x* equals the last one (in decimal notation). For example, such numbers as 101, 477474 or 9 will be included in the answer and 47, 253 or 1020 will not. 24 25 Help him and count the number of described numbers *x* for a given pair *l* and *r*. 26 27 Input 28 29 The single line contains a pair of integers *l* and *r* (1 ≤ *l* ≤ *r* ≤ 1018) — the boundaries of the interval. 30 31 Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specifier. 32 33 Output 34 35 On a single line print a single integer — the answer to the problem. 36 37 Examples 38 39 Input 40 41 ``` 42 2 47 43 ``` 44 45 Output 46 47 ``` 48 12 49 ``` 50 51 Input 52 53 ``` 54 47 1024 55 ``` 56 57 Output 58 59 ``` 60 98 61 ``` 62 63 Note 64 65 In the first sample the answer includes integers 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44.