#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void printInt(FILE* fp, const char* f, char* s) {
char* x, *a, *b, *p;
long i, t, n;
x = NULL;
if(! s)
return;
a = b = p = s;
for(t = atoi(s); *s; ) {
i = strtol(s, &x, 10);
if(!(n = x - s))
break;
if(i <= t) {
t = i;
a = s;
s += n;
b = s;
continue;
}
s += n;
}
fprintf(fp, f, t);
strcpy(a, b);
printInt(fp, f, strpbrk(p, "0123456789"));
}
int main(void) {
char str[128] = " 1000000 7000 5\t\n 300 350000 4300 \t 17 1111 -7 99 8 \n";
printInt(stdout, "%d\n", str);
return 0;
}