#include <iostream>
#include <algorithm>
#include <vector>
#include <iterator>
#include <string>
using std::cout;
using std::endl;
using std::vector;
using std::string;
int main()
{
vector<string> vec1 = { "a", "c", "e", "h" };
vector<string> vec2 = { "b", "d", "f", "h", "i" };
vector<string> vec3;
vec3.reserve(vec1.size() + vec2.size() + 1);
merge(vec1.begin(), vec1.end(), vec2.begin(), vec2.end(),
std::back_inserter<vector<string>>(vec3));
std::ostream_iterator<string> output(cout, " ");
std::copy(vec3.begin(), vec3.end(), output);
cout << endl;
return 0;
}
/*
run:
a b c d e f h h i
*/