#include<stdio.h>
#include <string.h>
int split(char *str, const char *delim, char dst[][80]) {
char *s = strdup(str);
char *token;
int n = 0;
for(token = strsep(&s, delim); token != NULL; token = strsep(&s, delim)) {
strcpy(dst[n++], token);
}
return n;
}
int main(void) {
char source[] = "hello, world! welcome to china!";
char delim[] = ",!";
char dst[10][80];
int cnt = split(source, delim, dst);
for (int i = 0; i < cnt; i++)
printf("%s\n",dst[i]);
return 0;
}