The only thing I can see is that there is a new paragraph only when there are 2 consecutive newline characters.. Can I use that as a condition?
If you choose to look at it that way...
You could have 2 consecutive newlines. Or 4. Or 10. Or 100. Or 10000. It doesn't matter. So your code shouldn't be checking for a
second newline, because the actual number of consecutive newlines doesn't matter. Because the layout of paragraphs looks something like:
non-newline data.One or more newlines.non-newline data.One or more newlines.non-newline data.One or more newlines.
If your data extraction method makes it easier for you to check consecutive newlines, what you shouldn't be doing is checking repeatedly for additional newlines. There's no point.
Think about it. There's two states your data extraction mechanism can be in. It can be extracting non-newline data. Or it can be extracting newline data. And your paragraph counter increases when you change from extracting non-newline data to extracting newline data.
So you need code that keeps repeatedly extracting non-newline data, checking if it has reached a newline or EOF. Then you increment a paragraph counter when you leave the loop. Then you start looping through the data, until you reach something that isn't a newline (or whitespace technically). You leave the loop when you reach a normal character. Then you go back to looping through normal characters, until you reach a newline or EOF. Then...so on.
One more thing. Are you sure that paragraphs are separated only by a single newline? I would imagine they would be separated by two or more newlines, but not a single newline.
In any case, your approach to the problem depends on how you extract the data. I answered your question assuming you inspected the data character by character.
If you're having trouble understanding the abstract, write it down on paper, and imagine you're the computer inspecting the data. What kind of logic are you following as you extract each character?