fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main(void) {
  5. char *strings[]={
  6. "1234;asdf;56;78;gh",
  7. "9876;lkjh;;54;",
  8. ";xcvb;09;18;nm"
  9. };
  10. char line[100];
  11. for(int i=0;i<3;i++){
  12. strcpy(line,strings[i]);
  13. char *end=line;
  14. while(*end){
  15. if(*end==';')*end=0;
  16. end++;
  17. }
  18. char *tok=line;
  19. while(tok<=end){
  20. printf("|%8s|",tok);
  21. tok+=strlen(tok)+1;
  22. }
  23. printf("\n");
  24. }
  25. }
  26.  
Success #stdin #stdout 0s 9424KB
stdin
Standard input is empty
stdout
|    1234||    asdf||      56||      78||      gh|
|    9876||    lkjh||        ||      54||        |
|        ||    xcvb||      09||      18||      nm|