This is a google code jam question. The input consist of
1st line:integer tells you how many cases
then the number of lines of text separated by space.
ex:
3
this is a sentence
this one too
and this one too
aim is to display it like this
case #1: sentence a is this
case #2: too one this
case #3: too one this and
Here is my code. A very simple error
it does this
case #1:
case #2: sentence a is this
case #3: too one this
EDIT:
The reason you do this is because the >> operator does not extract space characters from the input stream. So after you use the >> operator to read in number, the '\n' character is not extracted. Then when you try to use getline ( which is supposed to read until it encounters a new line character), getline will stop reading immediately because it has read a line delimiter and thus read an empty string. So your first case will print an empty string