#include <iostream>
#include <string>
using namespace std;
int main(void)
{
string name, str;
while (getline(cin, name))
{
getline(cin, str);
for (int i = 0, j = 0; i <= name.size(); i++)
{
if ((name[i] == ' '))
{
cout << str << ", " << name.substr(j, i - j) << endl;
j = i + 1;
}
}
for (int i = name.size() - 1; i >= 0; i--)
{
if (name[i] == ' ')
{
cout << str << ", " << name.substr(i + 1) << endl;
break;
}
}
}
return 0;
}
我知道問題在哪了
測資四是只有一個的情況