#include <iostream>
#include <cstring>
#include <vector>
using namespace std;
int main()
{
char sorce[] = "a\nAB\nabc\nABCD\nabcde\nABCDEF\n";
vector <char*>ans;
char *pch = strtok (sorce,"\n");
for (;pch != NULL;)
{
ans.push_back(pch);
pch = strtok (NULL, " ,.-");
}
for(int i = 0; i < ans.size(); i++)
cout << ans[i] << endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y3N0cmluZz4KI2luY2x1ZGUgPHZlY3Rvcj4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKCkKewogICAgICBjaGFyIHNvcmNlW10gPSAiYVxuQUJcbmFiY1xuQUJDRFxuYWJjZGVcbkFCQ0RFRlxuIjsKICAgICAgdmVjdG9yIDxjaGFyKj5hbnM7CgoKICAgICAgY2hhciAqcGNoID0gc3RydG9rIChzb3JjZSwiXG4iKTsKICAgICAgZm9yICg7cGNoICE9IE5VTEw7KQogICAgICB7CiAgICAgICAgICBhbnMucHVzaF9iYWNrKHBjaCk7CiAgICAgICAgICBwY2ggPSBzdHJ0b2sgKE5VTEwsICIgLC4tIik7CiAgICAgIH0KCiAgICAgIGZvcihpbnQgaSA9IDA7IGkgPCBhbnMuc2l6ZSgpOyBpKyspCiAgICAgICAgY291dCA8PCBhbnNbaV0gPDwgZW5kbDsKICAgICAgcmV0dXJuIDA7Cn0K