summaryrefslogtreecommitdiff
path: root/9p21.cpp
blob: be101b90ca4208252d28086b2ac1d1c42ffa41a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <iostream>
#include <list>
#include <vector>

/*
 *
 * 9.21
 *
 * It's the same thing. Vector does not have push_front so this would be necessary.
 * It's an expensive operation to do this so it woul be best to use a deque
 */

int main () {

	std::string word;
	std::vector<std::string> lst;
	auto iter = lst.begin();
	while (std::cin >> word) {
		iter = lst.insert(iter, word); // same as calling push_front
	}

	for(auto &a : lst) {
		std::cout << a << std::endl;
	}

	return 0;
}