fork(2) download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main(void) {
  5.  
  6. char input [1000];
  7.  
  8. char* token;
  9. fgets(input, 1000, stdin);
  10.  
  11. printf("%s\n", input);
  12.  
  13. token = strtok (input," ,.");
  14.  
  15. while (token != NULL){
  16. printf("%s\n",token);
  17. token = strtok(NULL, " ,.");
  18. }
  19.  
  20. return 0;
  21. }
  22.  
Success #stdin #stdout 0s 2164KB
stdin
one two three four.
stdout
one two three four.
one
two
three
four