#include <iostream> #include <string> using namespace std; int main() { char decode[256]; for (char ch = 'A'; ch <= 'Z'; ch++) decode[ch] = ch; string encoded = "H3LL0 MY L0V3, 1 M H499Y 83C4U53 500N 1 W1LL 83 70 Y0UR 51D3. 7H15 71M3 W17H0U7 Y0U H45 833N 373RN4L. 1 1NV173 Y0U 70 7H3 200 0N3 70 533 7H3 238R45 4ND 60R1L45."; string decoded = "HELLO MY LOVE, I M HAPPY BECAUSE SOON I WILL BE TO YOUR SIDE. THIS TIME WITHOUT YOU HAS BEEN ETERNAL. I INVITE YOU TO THE ZOO ONE TO SEE THE ZEBRAS AND GORILAS."; for (int i = 0; i < encoded.length(); i++) decode[encoded[i]] = decoded[i]; int cases; cin >> cases; string line; getline(cin, line); for (; cases; cases--) { getline(cin, line); while (line.length() > 0) { for (int i = 0; i < line.length(); i++) cout << decode[line[i]]; cout << endl; getline(cin, line); } if (cases > 1) cout << endl; } return 0; }
Friday, April 24, 2015
UVa 11946 - Code Number
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment