#include <iostream>
#include <fstream>
#include <string>
#include <vector>
int main()
{
int n;
std::cin >> n;
std::vector<std::string> fileNames(n);
for (int i = 0; i < n; ++i)
{
std::cin >> fileNames[i];
}
std::string outputFileName;
std::cin >> outputFileName;
std::ofstream outputFile(outputFileName);
for (const auto& fileName : fileNames)
{
std::ifstream inputFile(fileName);
if (
inputFile.is _open())
{
std::string line;
while (getline(inputFile, line))
{
outputFile << line << " ";
}
}
}
outputFile.close();
return 0;
}
#include <fstream>
#include <string>
#include <vector>
int main()
{
int n;
std::cin >> n;
std::vector<std::string> fileNames(n);
for (int i = 0; i < n; ++i)
{
std::cin >> fileNames[i];
}
std::string outputFileName;
std::cin >> outputFileName;
std::ofstream outputFile(outputFileName);
for (const auto& fileName : fileNames)
{
std::ifstream inputFile(fileName);
if ( inputFile.is _open())
{
std::string line;
while (getline(inputFile, line))
{
std::cout << outputFile << line << " ";
}
}
} outputFile.close();
return 0;
}