fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int
  5. main()
  6. {
  7. char s[100], *p;
  8. int cnt;
  9.  
  10. while (fgets(s, 100, stdin) != NULL) {
  11. s[strlen(s)-1]='\0';
  12. cnt = 0;
  13. p = strtok(s, " ");
  14. while ((p = strtok(NULL, " "))) {
  15. cnt++;
  16. if (*p != '0')
  17. printf("%d:%s ", cnt, p);
  18. }
  19. puts("");
  20. }
  21. return 0;
  22. }
Success #stdin #stdout 0.01s 1720KB
stdin
Standard input is empty
stdout
Standard output is empty