#include #include using namespace std; main() { list lines; list ::iterator lit; string s; while (!cin.eof()) { getline(cin, s); if (!cin.eof()) { lines.push_back(s); if (lines.size() > 10) lines.erase(lines.begin()); } } for (lit = lines.begin(); lit != lines.end(); lit++) { cout << *lit << endl; } }