I tried to solve this problem but for some reason the C++ compiler calculates power of 26 raised to 1 as 25 and I am getting wrong answer! Here is the submission link. http://codeforces.net/contest/1/submission/14859704 Any corrections to the code are appreciated. Also, if there are any internal compiler error, please let me know! P.S. I tried to debug the code and I am quite shocked after seeing the results.