#K94027. Largest Palindrome Finder

    ID: 38550 Type: Default 1000ms 256MiB

Largest Palindrome Finder

Largest Palindrome Finder

You are given a positive integer n. Your task is to find the largest palindrome number that is less than or equal to n. A number is considered a palindrome if its sequence of digits reads the same backward as forward. For example, 121 and 101 are palindromic numbers, whereas 123 is not.

Please note that the input will be provided via standard input and the output should be printed to standard output.

inputFormat

A single integer n is given on a single line from standard input.

outputFormat

Output the largest palindrome number that is less than or equal to n.## sample

123
121