#include #include #include #include using namespace std; int main() { char * text = (char*)malloc(10101*sizeof(char)); char * filtered = (char*)malloc(10101*sizeof(char)); int step; char c; // string text; // string filtered; while(1) { // for (int i = 0; i < 10000; ++i) text[i] = 0; //cin >> step; //if (!step) break; //cin >> text; // text = replaceAll(text, " ", ""); scanf("%d", &step); if (step==0) break; scanf("%c",&c); text = gets(text); // scanf("%s",text); // int x=0; // while(text[x])printf("%x ",text[x++]); // printf("\n"); int i=0, len = 0; while(text[i]) { if (text[i]!=' ' && text[i]!='\n'){ if (text[i]>='a' && text[i]<='z') text[i]-= 'a'-'A'; filtered[len]=text[i]; ++len; } ++i; } filtered[len]=0; // cout << text; int pos; int krok= len/step; if (len%step > 0){ ++krok; } for (i = 0; i < len/step+1; ++i) { pos = i; while(pos < len) { printf("%c", filtered[pos]); //text += filtered[pos]; pos += krok; } } printf("\n"); } free( text); free(filtered); return 0; }