#include #include int isAlphaNum (char input) { if ((input > 47 && input < 58) || (input > 65 && input < 91) || (input > 96 && input < 123)) { return 1; } return 0; } int readInput (int col, int spaces[1000], char str[col][100], int x, int y, int word) { char ch; scanf("%c", &ch); if (ch == EOF || ch == '\n') { return word + 1; } if (!isAlphaNum(ch)) { spaces[word] = ch; return readInput(col, spaces, str, x, y, word); } if (col == x) { x = 0; y++; } str[x][y] = ch; return readInput(col, spaces, str, x+1, y, word + 1); } int main (int argc, char *argv[]) { int col; scanf("%d", &col); char str[col][100]; for (int i = 0; i < col; i++) { for (int j = 0; j < 100; j++) { str[i][j] = 0; } } int spaces[1000] = {0}; getchar(); int words = readInput(col, spaces, str, 0, 0, 0); int space = 0, k = 0; for (int i = 0; i < col; i++) { for (int j = 0; j < 100; j++) { if (str[i][j] > 50) { printf("%c", spaces[k]); k++; } printf("%c", str[i][j]); } } printf("%c\n", spaces[k]); return 0; }