#P8431. Maximum k with Reversal Bound
Maximum k with Reversal Bound
Maximum k with Reversal Bound
Define \( f(x) \) as the integer obtained by reversing the digits of \( x \). For example:
- \( f(12323)=32321 \)
- \( f(114514)=415411 \)
- \( f(250)=52 \), because the reversed string "250" becomes "052" which is interpreted as \(52\)
Given an integer \( n \), find the maximum integer \( k \) such that for every positive integer \( m \) in the range \([1,k]\), the inequality \( f(m) \le n \) holds.
Input: A single integer \( n \).
Output: Output the maximum \( k \) satisfying the condition.
inputFormat
The input consists of one line containing a single positive integer \( n \).
outputFormat
Output a single number: the maximum \( k \) such that for every integer \( m \) (\( 1 \le m \le k \)), the reversed number \( f(m) \) is less than or equal to \( n \).
sample
100
100