Gleb and Two Numbers
시간 제한2초메모리 제한1024 MB
l과 r이 아주 긴 십진수 문자열로 주어질 때, [l, r] 구간에서 두 정수의 해밍 거리(자릿수가 다른 개수)의 최댓값을 구한다.
문제
When Gleb is not busy with writing long problem statements he enjoys playing with numbers. He picks two integers and and tries to find integers and such that and the Hamming distance between and is maximum possible.
The Hamming distance between two integers and 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 and the second line contains a single integer ().
출력
Print the maximum possible Hamming distance between a pair of integers in range from to .
힌트
In the first sample, one can choose integers and . In the second sample, and form an optimal answer.