problem with fast I/O

for the question LUCKYSTR Problem - CodeChef

the same solution with fast I/O functions is giving runtime error but with cin and cout showint AC. Can any one point the reason? here is my solution
http://www.codechef.com/viewsolution/6491542