This week's book giveaways are in the Refactoring and Agile forums. We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line! See this thread and this one for details.
I would suggest, as a start, that you read in the first line, tokenize it, than print out each token on a seperate line. You need to understand what you have in "s", before you can start processing it.
Please ignore post, I have no idea what I am talking about.