照題目要求去算即可得解。
C++(0.056)
/*******************************************************/
/* UVa 11687 Digits */
/* Author: Maplewing [at] knightzone.studio */
/* Version: 2012/09/27 */
/*******************************************************/
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
string x, last_x, tempstr;
int n, temp;
while( getline( cin, x ) ){
if( x == "END" ) break;
n = 0;
do{
n++;
last_x = x;
temp = x.length();
x = "";
while( temp ){
tempstr = (char)((temp%10)+(int)'0');
tempstr += x;
x = tempstr;
temp /= 10;
}
}while( last_x != x );
printf( "%d\n", n );
}
return 0;
}