couldn't solve LVADER - Luke vs. Darth Vader from SPOJ.

I tried to solve LVADER from spoj. Can anyone please provide detailed explanation to the solution of this problem.

Have a look at this.