Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: cyblox_boi

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

Language: cpp

Time: 0.003 second

Submitted On: 2026-01-01 03:07:36

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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    cin >> n;

    string text;
    cin.ignore();
    getline(cin, text);

    for (int i = 0; i < text.length(); i++)
    {
        if (isalpha(text[i]))
        {
            if (isupper(text[i]))
            {
                int temp = text[i] - 'A' - n;

                if (temp < 0)
                {
                    temp += 26;
                }

                temp %= 26;

                cout << (char)(temp + 'A');
            }
            else
            {
                int temp = text[i] - 'a' - n;

                if (temp < 0)
                {
                    temp += 26;
                }

                temp %= 26;

                cout << (char)(temp + 'a');
            }
        }
        else
        {
            cout << text[i];
        }
    }

    cout << '\n';

    return 0;
}