#include <stdio.h>
#include <string.h>
char * compress(char * text, const char * delims);
int main()
{
char text[] = "This - is an example, of text; ";
printf("Input : %s\n", text);
printf("Output: %s\n", compress(text, " ,.;!?"));
getchar();
return 0;
}
char * compress(char * text, const char * delims)
{
char * tok = strtok(text, delims);
while( tok )
{
tok = strtok(NULL, delims);
if( tok )
sprintf(text, "%s%s",text, tok);
}
return text;
}