http://mirror.codeforces.com/gym/101306/problem/D Here is an easy problem, but I get WA on test 6. Can you please tell me how to solve it or what I'm doing wrong? I guess that the "Martian to English" alphabet must be figured out from the test case examples (they include all of the 26 letters, uppercase and lowercase). So I put them in a 'map' and then print the answers, which is correct for the examples, but not for the 6th test. Here is my code: https://pastebin.com/sCZJnLZB
If you look closely, there is 51 (distinct)mapping in the samples, so you have to map the last one on your own.
Thanks.
I was going to say this but was a bit too late.
I appreciate your thinking on using a map.
A minor suggestion. Code would be a bit more readable if you wrote the dictionary like this.
Remember comments are good. But, self-documenting code is better. This is because as time goes on, code often evolves and changes, but comments don't. Rather than put in a comment saying n is the number of words, name n as number of words.
Also, another thing is that because you're using an STL string, you can use .length() ... it works in O(1) time. However, if this was a C-string, then you shouldn't have used strlen everytime because it makes the complexity O(n^2) instead of O(n). It's another minor thing that worked to your advantage here, but remember the complexities of the functions that you use.
Otherwise good work. You just missed out on the fact that there were 51 alphabets and not 52.