Task C. Binary Palindromes
We say that a number is a palindrome if it is the same when read from left to right or from right to left. For example, the number 75457 is a palindrome. Of course, the property depends on the basis in which the number is represented. The number 17 is not a palindrome in base 10, but its representation in base 2 (10001) is a palindrome, called binary palindrome. The objective of this problem is to count the binary palindromes in a given closed interval. Write a program C.EXE to solve the task.
The input consists of several (up to 100) lines. Each line represents an interval as two integer numbers - lower and upper bounds. Each number n (0 < n < 50000) is given in decimal basis. The input ends with a zero.
Your program must print the number of binary palindromes in the input interval.
1 17
101 111
0
7
1