Why am I getting WA?

,

WHO GETS HER

This is my solution : solution

Isn’t this is the same problem as : MISERMAN SPOJ

My solution was accepted there but for INSM02 it gives wrong answer.