Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<string>
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- int i,n,x,a;
- string str;
- char c;
- while(1)
- {
- cin>>n;
- if (n==0)
- {
- break;
- }
- else
- {
- cin>>str;
- reverse(str.begin(),str.end());
- for (i=0; i<str.size(); i++)
- {
- if (str[i]=='.')
- {
- a=28;
- x = (a+n)%28;
- if (x==28)
- str[i]='.';
- else if (x==27)
- str[i]='_';
- else
- str[i] = x+64;
- }
- else if (str[i]=='_')
- {
- a=27;
- x = (a+n)%28;
- if (x==0)
- str[i]='.';
- else if (x==28)
- str[i]='.';
- else if (x==27)
- str[i]='_';
- else
- str[i] = x+64;
- }
- else
- {
- c = str[i];
- a = c-64;
- x = (a+n)%28;
- if (x==0)
- str[i]='.';
- else if (x==28)
- str[i]='.';
- else if (x==27)
- str[i]='_';
- else
- str[i] = x+64;
- }
- }
- cout << str << end1;
- return 0;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement