Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include<math.h>
- int function(int l, int c);
- int main() {
- char str[1000010];
- while(1) {
- scanf("%s", &str);
- if(strcmp(str,"END")==0) break;
- if(strcmp(str, "1")==0) printf("1\n");
- else printf("%d\n", function(strlen(str),1));
- }
- return 0;
- }
- int function(int l, int c) {
- if (l == 1)
- return c + 1;
- int nl=0, oldLength(length);
- for (; l>0; l/= 10) nl++;
- return function(nl, c + 1);
- }
Add Comment
Please, Sign In to add comment