凯撒的密码破译,值得注意的一点是,A~E和F~Z的加密方法不同,前者向后移动21位,后者向前移动5位即可
#include<iostream>
#include<cstring>
#include<vector>
#include<cstdio>
#include<algorithm>
using namespace std;
const int MAX = 100001;
int main()
{ char s[300];
while(gets(s))
{
if(strcmp(s,"START")==0) continue;
if(strcmp(s,"END")==0) continue;
if(strcmp(s,"ENDOFINPUT")==0) break;
int n = strlen(s);
for(int i=0;i<n;i++)
{
if(s[i]>='F') s[i] -= 5;
else if(s[i]>='A'&&s[i]<'F') s[i] += 21;
}
cout<<s<<endl;
}
return 0;
}