Palindrome Numbers
InterviewTime limit1sMemory limit1024 MB
Given n below 10^10, count the palindrome numbers from 1 to n inclusive.
- Level
Easy3 of 10
- Topics
- Math, Implementation
- Solved
- No attempts yet
Problem
For a positive integer , if the digits of read from left to right are the same as the digits read from right to left, is called a palindrome number. For example, , , and are all palindrome numbers. Given a positive integer , write a program that prints the number of distinct palindrome numbers less than or equal to . For example, when , there are 10 palindrome numbers up to 20 (, , , , , , , , , ).
Input
The input is read from standard input. The first line contains a positive integer ().
Output
The output is written to standard output. Print the number of distinct palindrome numbers less than or equal to on one line.