11687 - Digits

#include<stdio.h>

#include<string.h>

char a[10000010];

int p;

int solve(int x)

{ 

	int y;

	sprintf(a,"%d",x);

	y=strlen(a);

	p++;

	if(x==y) return p;

	solve(y);

}

int main()

{

	while(gets(a)){

		p=1;

		if(strcmp(a,"END")==0) break;

		else if(strcmp(a,"1")==0) puts("1");

		else printf("%d\n",solve(strlen(a)));

	}

	return 0;

}


你可能感兴趣的:(git)