// itera.cpp: Iterator-based version of introstl.cpp
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
 vector<string> v;
 cout << "Enter lines of text to be sorted.\n";
 cout << "followed by the word stop:\n";
 for (;;) {
  string s;
  getline(cin, s);
  if (s == "stop")
   break;
  v.push_back(s);
 }
 sort(v.begin(), v.end());
 cout << "The same lines after sorting:\n";
 for (vector<string>::iterator i = v.begin(); i != v.end(); ++i)
  cout << *i << endl;
 return 0;
}
