#include <iostream>
using namespace std;

int main()
{
    int dl;
    string txt;
    unsigned char c;
    unsigned int klucz;


    cout<< " wpisz tekst :";
    getline(cin,txt);
    cout<<endl<<" Podaj Klucz :";
    cin>>klucz;
    dl=txt.length();

    for(int i=0; i<dl; i++)
    {
     c=txt[i];
     if (islower(c))
     {
     if ( isalpha( c )){
                        c+=klucz;   // c=c+klucz;
                       if (c >'z') c-=26;
     }
     }
     else {
             if ( isalpha( c )) {
                    c+=klucz;
                if (c >'Z') c-=26;
             }
     }
     txt[i]=c;
    }
    cout << txt << endl;
    return 0;
}
