#include <stdio.h> #include <string.h> int NumFilter(const char* in_str, char** out_arr) { int index=0, n; char *p = in_str; if (in_str==NULL) return 0; for (; *p; ++p) if (sscanf(p, "%[0-9]%n", out_arr[index], &n)>0) { p+=n-1, ++index; } return index; } int main() { char str[1024]; char* arr[100], _arr[100][100]; int n; for (n=0; n<100; ++n) arr[n] = _arr[n]; while (gets(str)) { int len = NumFilter(str, arr); for (n=0; n<len; ++n) printf("%s ", arr[n]); puts(""); } return 0; }