diff options
Diffstat (limited to '9p21.cpp')
-rw-r--r-- | 9p21.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/9p21.cpp b/9p21.cpp new file mode 100644 index 0000000..be101b9 --- /dev/null +++ b/9p21.cpp @@ -0,0 +1,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; +} |