#include "iostream"#include "string"#include "vector"usingnamespacestd;
using S = vector<string>;//定义别名
S concat(const S &lh1,const S & lh2)//解决两个S类型集合的组合
{
S result;
for (auto &it1 : lh1)
for (auto &it2 : lh2)
result.push_back(it1 + it2);//存入一次字符串的组合return result;
}
S accumulate(vector<S> List)
{
S result = List.front();
for (auto it = List.begin() + 1; it != List.end();++it)
result = concat(result, *it);//进行一次组合return result;
}
int main()
{
string s;
vector<S> List;
while (getline(cin,s))
{
S temp;
for (auto it = s.begin();it!=s.end();++it)
{
string temps;
while (it!=s.end()&&!isspace(*it))//遇到一个不是空格的时候
temps.push_back(*it++);
temp.push_back(temps);
if (it == s.end())
break;
}
List.push_back(temp);
}
S result;
result = accumulate(List);
for (auto r : result)
cout << r<<" ";
return0;
}