#include <string>
#include <iostream>
#include <algorithm>
#include <vector>
#include <fstream>
using namespace std;
int main()
{
ifstream in("data.txt");
string strtmp;
vector<string> vect;
while (getline(in,strtmp,'\n'))
vect.push_back(strtmp);
copy(vect.begin(),vect.end(),ostream_iterator<string>(cout,"\n"));
cout<<endl;
string strset="|, ";
vector<string> v[3];
vector<string>::iterator it;
int i=0;
for (it=vect.begin();it!=vect.end();it++,i++)
{
int first1=it->find_first_of(strset);
int first2=it->substr(first1).find_first_not_of(strset)+first1;
int last1=it->find_last_of(strset);
int last2=it->substr(0,last1).find_last_not_of(strset);
v[i].push_back(it->substr(0,first1));
v[i].push_back(it->substr(first2,last2-first2+1));
v[i].push_back(it->substr(last1+1));
}
for (i=0;i<3;i++)
{
copy(v[i].begin(),v[i].end(),ostream_iterator<string>(cout," "));
cout<<endl;
}
return 0;
}