//第一次竟然因为map的映射中写错了一个而WA了一次,哎,粗心!
#include "iostream"
#include "string"
#include "map"
#include "cctype"
using namespace std;
map<char, char> m;
int main()
{
m['A'] = 'V', m['B'] = 'W', m['C'] = 'X', m['D'] = 'Y', m['E'] = 'Z',
m['F'] = 'A', m['G'] = 'B', m['H'] = 'C', m['I'] = 'D', m['J'] = 'E',
m['K'] = 'F', m['L'] = 'G', m['M'] = 'H', m['N'] = 'I', m['O'] = 'J',
m['P'] = 'K', m['Q'] = 'L', m['R'] = 'M', m['S'] = 'N', m['T'] = 'O',
m['U'] = 'P', m['V'] = 'Q', m['W'] = 'R', m['X'] = 'S', m['Y'] = 'T', m['Z'] = 'U';
string input, ans;
int len, i;
while (1)
{
getline(cin, input);
if (input == "START" || input == "END") continue;
if (input == "ENDOFINPUT") break;
ans.clear();
len = input.length();
for (i = 0; i < len; i++)
{
if (isalpha(input[i]))
ans.push_back(m[input[i]]);
else
ans.push_back(input[i]);
}
cout << ans << endl;
}
system("pause");
}
poj 1298 The Hardest Problem Ever
最新推荐文章于 2022-02-25 21:57:21 发布