OJ-Problems-Source/HDOJ/1048_autoAC.cpp

35 lines
731 B
C++
Raw Normal View History

2016-08-12 10:14:21 +08:00
#include <iostream>
#include <string>
using namespace std;
const int LEN = 210;
char engChars[30] = {"ABCDEFGHIJKLMNOPQRSTUVWXYZ"};
char aLine[LEN];
void decipher()
{
for (int i = 0;i < strlen(aLine);i ++)
{
if (isalpha(aLine[i]))
{
int offset = (aLine[i] - 'A' + 26 - 5) % 26;
aLine[i] = engChars[offset];
}
}
}
int main ()
{
while (gets(aLine))
{
if (strcmp(aLine,"ENDOFINPUT") == 0)
break;
while (1)
{
gets(aLine);
if (strcmp(aLine,"END") == 0)
break;
decipher();
printf("%s\n",aLine);
}
}
return 0;
}