Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: Pera

Problemset: ครัวซองค์รสซีซาร์

Language: cpp

Time: 0.002 second

Submitted On: 2025-09-04 12:10:57

#include <bits/stdc++.h>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);

    int n; cin >> n;
    string s; getline(cin >> ws, s);

    for (char &c : s) {
        if (isalpha(c)) {
            char base = islower(c) ? 'a' : 'A';
            if (c - base - n >= 0) {
                c = c - n;
            } else {
                c = c - n + 26;
            }
        }
    }

    for (char &c : s) {
        cout << c;
    }
    cout << '\n';
}