#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
vector<string> ret;
inline void solve(const string & str )
{
int Len=str.size();
int Left=Len-1;
int Right=Len-1;
while( Left>=0 )
{
if( ' '!=str[Left] )
{
--Left;
}
else if( ' '==str[Left] )
{
if( Left==Right )
{
--Left;
--Right;
}
else
{
string temp=str.substr( Left+1, Right-Left );
ret.push_back( temp );
Right=Left;
--Left;
--Right;
}
}
}
//收尾
if( Left!=Right )
{
string temp=str.substr( Left+1, Right-Left );
ret.push_back( temp );
}
}
int main()
{
char str[maxn];
while( cin.getline(str,maxn) )
{
ret.clear();
string temp=str;
int L=temp.size();
for(int i=0; i<L; ++i)
{
if( 0==isalpha( temp[i] ) )
{
temp[i]=' ';
}
}
solve( temp );
int Len=ret.size();
for(int i=0; i<Len; ++i)
{
printf("%s%c", ret[i].c_str(), (i!=Len-1) ? ' ' : '\n' );
}
}
return 0;
}