String operations are too weak .... It took nearly three hours, but it would take a while. Otherwise it would go crazy.
[Cpp]
# Include <iostream>
Using namespace std;
Int main ()
{
Char x [20], y [20], t [100] [20];
Int I, j, num, len, n;
While (scanf ("% s", x )! = EOF)
{
Num = 0;
While (1)
{
Strcpy (t [num], x );
Len = strlen (x );
For (I = 0; I <len; I ++) y [len-1-i] = x [I]; y [len] = '\ 0'; // flip
If (strcmp (x, y) = 0) break; // not equal
Num ++; // The total number of times + 1
For (I = 0; I <len; I ++) x [I] + = y [I]-'0'; // sum up to obtain the new x
// Printf ("!! After adding x = % s \ n ", x );
For (I = len-1; I> 0; I --)
If (x [I]> '9 ')
{
X [I-1] ++;
X [I]-= 10;
}
If (x [0]> '9 ')
{
X [0]-= 10;
For (I = len; I> 0; I --)
X [I] = x [I-1];
X [0] = '1 ';
X [len + 1] = '\ 0 ';
}
// Printf ("!! X = % s \ n ", x );
// System ("pause ");
}
Printf ("% d \ n % s", num, t [0]);
For (I = 1; I <= num; I ++)
Printf ("---> % s", t [I]);
Printf ("\ n ");
}
Return 0;
}