fork download
  1. #include <ctype.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4.  
  5. void sprint(const char *i) {
  6. while (isdigit((unsigned char)*i)) {
  7. putchar(*i);
  8. for (int k = 0; k < *i - '0'; k++) putchar('*');
  9. i++;
  10. }
  11. }
  12.  
  13. void iprint(int i) {
  14. if (i > 9) iprint(i/10);
  15. putchar(i % 10 + '0');
  16. for (int k = 0; k < i % 10; k++) putchar('*');
  17. }
  18.  
  19. int main(void) {
  20. char in[99];
  21. while (fgets(in, 99, stdin)) {
  22. sprint(in);
  23. printf(" ---- ");
  24. iprint(atoi(in));
  25. printf("\n");
  26. }
  27. return 0;
  28. }
  29.  
Success #stdin #stdout 0s 9424KB
stdin
1352
98302
1
2
0
1000
1111
999
stdout
1*3***5*****2** ---- 1*3***5*****2**
9*********8********3***02** ---- 9*********8********3***02**
1* ---- 1*
2** ---- 2**
0 ---- 0
1*000 ---- 1*000
1*1*1*1* ---- 1*1*1*1*
9*********9*********9********* ---- 9*********9*********9*********