//
//  Lists.cpp  -  List of Lists of C++ strings using STL
//

#include <string>
#include <iostream>
#include <list>

using namespace std;

typedef list<string> LISTSTRING;

void prnt (LISTSTRING lst)
{
    LISTSTRING::iterator i;
    for (i = lst.begin(); i != lst.end(); i++)
        cout << *i << " | ";
    cout << endl << endl;
}

int main(int argc, char* argv[])
{
    string s("List of Lists of");
    LISTSTRING lst;

    s += " C++ strings";
    cout << endl << s << endl << endl;

    lst.insert (lst.begin(), "2-2");
    lst.insert (lst.begin(), "1-1");
    lst.insert (lst.end(), "3-3");
    lst.insert (lst.end(), "4-4");

    prnt(lst);

    list<LISTSTRING> ls2;
    list<LISTSTRING>::iterator i;
    ls2.insert (ls2.begin(), lst);

    lst.remove("2-2");  lst.remove("3-3");
    prnt(lst);
    ls2.insert (ls2.end(), lst);

    cout << endl << s << endl << endl;

    for (i = ls2.begin(); i != ls2.end(); i++)
        prnt (*i);

    return 0;
}

