#include <ctype.h>
#include <stdio.h>
#include <string.h>

void caesar_encrypt(const int shift, char text[]);

int main() {
    printf("Enter the shift (N): ");
    int shift;
    scanf("%d", &shift);

    printf("Enter the string to encrypt: ");
    char string[11];
    scanf("%10s", string);

    char encrypted[strlen(string) + 1];
    strcpy(encrypted, string);

    caesar_encrypt(shift, encrypted);

    printf("%s\n", encrypted);

    return 0;
}

void caesar_encrypt(const int shift, char text[]) {
    for (int index = 0, length = strlen(text); index < length; index++) {
        if (isupper(text[index])) {
            text[index] = 'A' + (text[index] - 'A' + shift) % 26;
        }
        if (islower(text[index])) {
            text[index] = 'a' + (text[index] - 'a' + shift) % 26;
        }
    }

    text[strlen(text)] = '\0';
}
