Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #define NMAX 103
- #define SEP " "
- char s[NMAX], aux[NMAX];
- int main() {
- gets(s);
- char *token = strtok(s, SEP);
- while (token) {
- char *p = strchr(token, ',');
- if (p) {
- strncat(aux, token, strlen(token) - strlen(p));
- } else {
- strcat(aux, token);
- }
- strcat(aux, " ");
- token = strtok(NULL, SEP);
- }
- strcpy(s, aux);
- puts(s);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement