wa in AND plz help

problem : http://www.spoj.com/problems/AND/
solution : http://ideone.com/qJTOHy

I am trying this question using tries Plz help how to rectify this code

//