Receive input until 2 newlines

Building a trie and expected to receive input in this format:

2 The man ate
5 The man SITS
1 The cat ate
777 This doesn't overlap


The

Should Return:

man SITS
man ate
cat ate
man 2

Basically the first number is the weight, which in need to separate out, then there is the phrase which I am trying to put into a string vector, then after an unknown number of phrases, there will be 2 newlines followed by the prefix we want to complete.

What Im not sure about how to do is receive the input until the two newlines. This is what I have that works to receive a single line.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
  
    int weight;
    string allwords;
    string word;
    vector <string> words;
    
    
    getline(cin, allwords);
    istringstream iss(allwords);
    
    while (iss >> word) {
        words.push_back(word);
    }
    
    string num = words[0];

    istringstream (num) >> weight;
    words.erase(words.begin());
if(allwords.empty())
Topic archived. No new replies allowed.