WA in cipher AC in Decryption

I submitted a solution for Decryption(http://www.codechef.com/problems/CF01) and got AC : (http://www.codechef.com/viewsolution/3655596)

I find the this problem similar to it Cipher (http://www.codechef.com/status/GOC05) and submitted the same solution (http://www.codechef.com/viewsolution/3663880) but got WA …

Actually i took part in a contest and faced the question Cipher which i couldn’t get AC … I practiced later at Decryption and found that my logic was “seemingly” correct but not getting AC on Cipher… Can anyone please point out my mistake in understanding the two questions… Thanks in advance

Desperately in need of some help here :frowning: