시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 37 16 14 63.636%

문제

뒤에서부터 읽어도 원래 문자열과 같은 문자열을 팰린드롬이라고 한다. 숫자 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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