// G. Hagopian PPP8 ex 6

#include <string>
#include <vector>
#include <iostream>
#include <algorithm> // std::swap

void print(const std::vector<std::string>& v) {
	for (std::string s : v)
		std::cout << s << std::endl;
}

void reverse(std::vector<std::string>& vs) {
	for (int i = 0; i < vs.size()/2; ++i)
		std::swap(vs[i], vs[vs.size() - 1 - i]);
}

int main() {
	std::vector<std::string> vs;
	std::string s;
	std::cout << "\nEnter a sequence of strings, \"q\" to stop:";
	while (std::cin >> s) { //&& s != "q"
		if (s == "q") break;
		vs.push_back(s);
	}
	std::cout << "\nYou entered: ";
	print(vs);
	reverse(vs);
	std::cout << "\nHere they are in reverse order: ";
	print(vs);
	std::cin.ignore();
	std::cin.get();
}

