시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 26 10 9 52.941%

문제

뒤에서부터 읽어도 원래 문자열과 같은 문자열을 팰린드롬이라고 한다. 숫자 A의 부분 문자열 중에서 길이가 1보다 큰 팰린드롬이 없는 숫자를 무-팰린드롬 숫자라고 한다.

16276는 무-팰린드롬 숫자이다. 하지만, 17276의 부분 문자열 727은 팰린드롬이기 때문에 17276은 무-팰린드롬 숫자가 아니다.

두 수 a와 b가 주어졌을 때, a보다 크거나 같고, b보다 작거나 같은 숫자 중에서 무-팰린드롬 숫자의 개수를 구하는 프로그램을 작성하시오.

입력

첫째 줄에 두 정수 a와 b가 주어진다. (0 ≤ a ≤ b ≤ 1018)

출력

a보다 크거나 같고, b보다 작거나 같은 정수 중에서 무-팰린드롬 숫자의 개수를 첫째 줄에 출력한다.

예제 입력 1

123 321

예제 출력 1

153
W3sicHJvYmxlbV9pZCI6IjYyODkiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWJiMzQtXHVkMzMwXHViOWIwXHViNGRjXHViODZjIFx1YzIyYlx1Yzc5MCIsImRlc2NyaXB0aW9uIjoiPHA+XHViNGE0XHVjNWQwXHVjMTFjXHViZDgwXHVkMTMwIFx1Yzc3ZFx1YzViNFx1YjNjNCBcdWM2ZDBcdWI3OTggXHViYjM4XHVjNzkwXHVjNWY0XHVhY2ZjIFx1YWMxOVx1Yzc0MCBcdWJiMzhcdWM3OTBcdWM1ZjRcdWM3NDQgXHVkMzMwXHViOWIwXHViNGRjXHViODZjXHVjNzc0XHViNzdjXHVhY2UwIFx1ZDU1Y1x1YjJlNC4gXHVjMjJiXHVjNzkwIEFcdWM3NTggXHViZDgwXHViZDg0IFx1YmIzOFx1Yzc5MFx1YzVmNCBcdWM5MTFcdWM1ZDBcdWMxMWMgXHVhZTM4XHVjNzc0XHVhYzAwIDFcdWJjZjRcdWIyZTQgXHVkMDcwIFx1ZDMzMFx1YjliMFx1YjRkY1x1Yjg2Y1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