#K90877. Symmetrical Number Transformation
Symmetrical Number Transformation
Symmetrical Number Transformation
You are given a positive integer n. Your task is to transform this number into a symmetrical (palindromic) number by repeatedly adding the reverse of the number to itself. A number n is said to be palindromic if it satisfies \(n = \text{reverse}(n)\), where \(\text{reverse}(n)\) denotes the integer obtained by reversing the decimal digits of n.
The process is as follows:
- If n is already a palindrome, the process stops immediately.
- Otherwise, compute \(r = \text{reverse}(n)\), then update \(n = n + r\) and increment the step counter.
- Repeat the process until n becomes palindromic.
Output the number of steps taken and the resulting palindromic number.
Note: Ensure that your program reads input from standard input (stdin) and writes output to standard output (stdout).
inputFormat
The input consists of a single line containing a positive integer n.
Example:
56
outputFormat
Output two integers separated by a space: the number of steps required and the resulting palindromic number.
Example:
1 121## sample
1331
0 1331