spoj problem bitmap WA

Can any one help me in this problem i am getting wrong answer and i am not able to figure out why?
problem:link text
my solution:link text

Hey @hit12345

In the attached ideone link you have taken the input with spaces in between. The question mentions that we will take words as input. This means there will be no spaces in between 0s and 1s. Try removing the spaces and you will not get the desired output.

1 Like

Thanks man i figured it out and solved it but now i am getting TLE so need to change my approch.