Why my solution hacked ?

What is wrong in solution?

Your solution fails for this test case

ab bb

Your output:

abb

expected output:

ab

I left = sign.
Thanks.