WHY TLE ???

Was trying to solve http://www.codechef.com/problems/KAN13C .
but its giving TLE though it almost matches with the codes submitted with AC.
eg-http://www.codechef.com/viewsolution/3104494.
AND here is mine http://www.codechef.com/viewsolution/3433553
plz give reasons as Why my code takes longer than it though both time complexity is O(N).N=lenght of text.

help …:frowning:

Please provide the link which is proper!!
Such a link does not exist!

I fixed the link - it’s bad formatting here at forum…