#C10798. Find Palindromic Numbers
Find Palindromic Numbers
Find Palindromic Numbers
You are given a positive integer \( n \). Your task is to print all palindromic numbers that are less than \( n \). A palindromic number is a number that remains the same when its digits are reversed. For example, 121 is a palindromic number, while 123 is not.
The input will be provided via stdin
and the output should be printed to stdout
as a single line of numbers separated by spaces.
Consider the following examples:
- If \( n = 10 \), then the palindromic numbers from 0 to 9 are: 0 1 2 3 4 5 6 7 8 9.
- If \( n = 50 \), then the palindromic numbers are: 0 1 2 3 4 5 6 7 8 9 11 22 33 44.
Your program should list all such numbers in increasing order.
inputFormat
The input consists of a single integer \( n \) which is given on one line from stdin
.
\( n \) satisfies \( 1 \leq n \leq 10^5 \).
outputFormat
Output all palindromic numbers less than \( n \) in increasing order in one line. The numbers should be separated by a single space. The output should be printed to stdout
.
10
0 1 2 3 4 5 6 7 8 9