I keep getting segfaults on following code! Can anyone explain what is happening?

```
#include <iostream>
#include <sstream>
#include <string>
#include <vector>

using namespace std;

int main()
{
    string line;
    getline(cin, line, '\n');
    istringstream iss(line);
    vector<string> result;

    for(string token; getline(iss, token, ' '); )
    {
        //if(token.empty()) continue;
        result.push_back(token); // << Segfaults here
    }

    for(int i = result.size()-1; i>=0; i++)
    {
        cout << result[i] << ' ';
    }

    return 0;
}

```