I am trying to get rid of the comma and store the second word in secondWord, and then output secondWord.
my code:
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
int main() 
{
    istringstream inSS;       
    string lineString;        
    string firstWord;         
    string secondWord;       
    int i;
    bool correct = false;
    cout << "Enter input string:" << endl;
    while (!correct) 
    {
        // Entire line into lineString
        getline(cin, lineString);
        // Copies to inSS's string buffer
        inSS.clear();
        inSS.str(lineString);
        // Now process the line
        inSS >> firstWord;
        // Output parsed values
        if (firstWord == "q")
        {
            cout << "q" << endl;
            correct = true;
        }
        inSS >> secondWord;
        if(secondWord[i] != ',')
        {
            cout<<"Error: No comma in string."<<endl;
        }
        else if (secondWord[i] == ',')
        {
            cout << "First word: " << firstWord << endl;
            cout << "Second word: " << secondWord << endl;
            cout << endl;
        }
    }
    return 0;
}
acceptable inputs: Jill, Allen Jill , Allen Jill,Allen
The code produces the comma as the second word, but I would like to get rid of the comma and space and out the second word.
 
    