······
include <iostream>
include <string>
using namespace std;
int main() {
string str = "VWXYZABCDEFGHIJKLMNOPQRSTU";
string inputStr;
int i;
while (1) {
getline(cin, inputStr);
if (inputStr == "ENDOFINPUT") break;
getline(cin, inputStr);
for (i = 0; inputStr[i] != '\0'; i++) {
if (inputStr[i] >= 'A'&&inputStr[i] <= 'Z') {
cout << str[inputStr[i] - 'A'];
}
else {
cout << inputStr[i];
}
}
cout << endl;
getline(cin, inputStr);
}
system("pause");
return 0;
}
······
感覺這道題改編為cpp還是有點難度的