Time

16:04:18
22 May 2012
Version for print

The level of palindrome

prb29

   You have a natural number M. If it is not a palindrome, than we write it in back order and add it to natural number M. Steps is repeat till we will receive a number- palindrome. The quantity of operations we call the level of palindrome of natural number M.

   Find the level of palindrome of number M.

 


Specifications

   Input

   One number Ì (0 < Ì < 10000).

   Output

   One number is the level of palindrome.


Problem information

Time Limit: 1 seconds
Memory Limit: 64 MB
Balls for the passed test: 10
Complexity: 36% 303/477

Example

Example input

865

Example output

2


← Product Problems Certification →