preventing double printing by eating the new line input