Solved..!! actually need to read the input stream continuously in a while loop so as to pass the test