int ch, N = 0; while ((ch = getchar()) != EOF) { if (isspace(ch)) a[N++] = ' '; else if (isprint(ch)) a[N++] = ch; }