Gleb and Two Numbers | 프로그래밍의 벗 PivotOJ
PivotOJ

Gleb and Two Numbers

시간 제한: 2000ms메모리 제한: 1024MB출처: MOOI 2016-17 finalBOJ 30756

문제

When Gleb is not busy with writing long problem statements he enjoys playing with numbers. He picks two integers ll and rr and tries to find integers aa and bb such that l \le a \le b ≤ r and the Hamming distance between aa and bb is maximum possible.

The Hamming distance between two integers xx and yy is defined as the number of decimal places at which they are different. If these integers are of different length, the shorter one is prepended with leading zeroes.

입력

The first line of the input contains a single integer ll and the second line contains a single integer rr (1lr1010000001 \leq l \leq r \leq 10^{1\,000\,000}).

출력

Print the maximum possible Hamming distance between a pair of integers in range from ll to rr.

힌트

In the first sample, one can choose integers 1212 and 1616. In the second sample, 11 and 1010 form an optimal answer.

예제

예제 1

입력
11
17
출력
1

예제 2

입력
1
11
출력
2
코드를 제출하려면 로그인하세요.