#include <iostream>
#include <list>
using std::cout;
using std::endl;
using std::list;
int main()
{
list<char> lst, revlst;
for (int i = 0; i < 5; i++)
lst.push_back('a' + i);
list<char>::iterator p;
while (!lst.empty()) {
p = lst.begin();
cout << *p;
revlst.push_front(*p);
lst.pop_front();
}
cout << endl;
p = revlst.begin();
while (p != revlst.end()) {
cout << *p;
p++;
}
cout << endl;
return 0;
}
/*
run:
abcde
edcba
*/