思路
一道简单的入门题,列出表,然后输入输出就行。不过最开始智商被压制了,漏掉了字母 D <script type="math/tex" id="MathJax-Element-1">D</script>, WA 到哭。
代码
#include <cstring>
#include <cstdio>
using namespace std;
int main()
{
char table[250];
char text[1000];
table[0] = '\n';
for(int i=1; i<'A'; i++) table[i] = i;
table['A'] = 'V';
table['B'] = 'W';
table['C'] = 'X';
table['D'] = 'Y';
table['E'] = 'Z';
for(int i='F'; i<='Z'; i++) table[i] = i-5;
while(true)
{
gets(text);
if(strcmp(text, "ENDOFINPUT")==0) break;
else if(strcmp(text, "END")==0) ;
else if(strcmp(text, "START")==0) ;
else
{
int len = strlen(text);
for(int i=0; i<=len; i++) printf("%c", table[text[i]]);
}
}
return 0;
}