WORD_DISTANCE problem

All cases given are passing right. But on submission test cases are failing.