#include #include #include #include using namespace std; char toupper(const char c) { if(c > 96) { return(c - 32); } return(c); } int main(void) { while(1) { int n, cnt=0; char orig[10000]; char enct[10000]; char c; scanf("%d", &n); getchar(); //printf("n is: %d\n", n); if(n == 0) { break; } while( ((c = getchar()) != '\n') ) { if(c == ' ') continue; orig[cnt] = toupper(c); cnt++; } //printf("cnt is: %d\n", cnt); if(cnt < n) { cout << orig << endl; } else { int pos_old = 0 - n; int round = 0; for(int i = 0; i < cnt; i++) { int pos = (pos_old + n) % cnt; if(pos < pos_old) { round++; pos_old = 0 - n + round; i--; continue; } pos_old = pos; /*printf("i %d pos %d cnt %d\n", i, pos, cnt);*/ //printf("pos is: %d\n", pos); enct[pos] = orig[i]; //orig[i] = '\0'; } cout << enct << endl; } //printf("%s\n", enct); for(int i = 0; i < cnt; i++) { enct[i] = 0; orig[i] = 0; } } return(0); }