// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
#include <iostream>
#include <vector>
#include <numeric>

std::string join(std::vector<std::string> elements, std::string seperator)
{
    if (elements.empty())
    {
        return std::string("");
    }
    return std::reduce(std::next(elements.begin()), elements.end(), elements[0], [seperator](std::string a, std::string s) {
        return a + seperator + s;
    });
}

int main(int argc, char* argv[])
{
    std::vector<std::string> strings = { "Hello", "World", ",", "Oh", "Wait", "no", "the", "world", "is", "on", "fire" };
    std::cout << join(strings, std::string(" ")) << std::endl;
    return 0;
}
