#include #include int main(int argc, char **argv) { int cipher; char *msg = (char *)malloc(10001 * sizeof(char)); char *enc; char c; char diff = 'A' - 'a'; int len; char *ence; char *encp; int first = 1; while(1) { scanf("%d", &cipher); if(cipher == 0) break; char *msgp = msg; char *msgp2 = msg; getchar(); c = getchar(); while(c != '\n') { if(c >= 'a' && c <= 'z') *(msgp++) = c + diff; else if(c >= 'A' && c <= 'Z') *(msgp++) = c; c = getchar(); } len = msgp - msg; enc = (char *) calloc(len + 1, sizeof(char)); ence = enc + len; encp = enc; int i = 0; for(; msgp2 < msgp; msgp2++) { //putchar(*msgp2); *encp = *msgp2; encp += cipher; if(encp >= ence) { i++; encp = enc + i; } } //if(!first) printf("\n"); printf("%s\n", enc); first = 0; } return 0; }