The input begins with a single positive integer on a line by itself indicating the number of cases, each described as below. This is followed by a blank line, and there will be a blank line between each two consecutive inputs.
cin >> cases;
cin >> throwAway; // Handles the blank line after the case input
for (int i = 0; i != cases; ++i)
{
while (something for your case)
{
// Do whatever you need to for each case
}
cin >> throwAway; // Handles the space between each case
}
That is probably the most simple way to go about it I would guess. There is probably a better way like using the blank lines to determine when the next case is, but I can't be sure without the whole problem.