// itdeque.cpp: Using a deque instead of a vector
#include <iostream>
#include <string>
#include <deque>
#include <algorithm>
using namespace std;

int main() {
 deque<string> v;
 cout << "Enter your 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_front(s);
 }
 sort(v.begin(), v.end());
 cout << "The same lines after sorting:\n";
 for (deque<string>::iterator i = v.begin(); i != v.end(); ++i)
  cout << *i << endl;
 return 0;
}
