#include <iostream> #include <iomanip> #include <cstring> using namespace std; string s; int main() { int k;//限制输入0<=k<26 cin>>k>>s; int n=s.length(); for (int i=0; i<n; i++) { if (s[i]<='Z'&&s[i]+k>'Z') s[i]=(s[i]+k)%'Z'+'A'-1; else if ('A'<=s[i]&&s[i] <='Z') s[i]+=k; } char pre; int st=-1; for (int i=0; i<n; i++) { if(s[i]<'A'||s[i]>'Z') { if (st==-1) { st=i; pre=s[i]; } else { char tmp=s[i]; s[i]=pre; pre=tmp; } } } if(st !=-1) s[st]=pre; cout<<s<<endl; return 0; }