题目:http://acm.hdu.edu.cn/showproblem.php?pid=2716
AC代码(C++):
#include <iostream> #include <queue> #include <string> #include <algorithm> #include <math.h> #define INF 0x3f3f3f3f #define eps 1e-8 using namespace std; int main() { char key[30]; char str[100]; while (cin >> key) { getchar(); cin.getline(str, 100); for (int i = 0; i < strlen(str); i++) { if (str[i] == ' ')continue; int tmp = str[i] - 'a'; bool upper = false; if (tmp < 0) { upper = true; tmp += 'a' - 'A'; } str[i] = key[tmp]; if (upper)str[i] -= 'a' - 'A'; } cout << str << endl; } //system("pause"); }总结: 水题...虽然是水题但是让我明白了这种题都是要循环测试用例的...