How to take input and print output in interactive problems in which test cases are not know and EOF is not expected ?