#include <bits/stdc++.h>
using namespace std;
int main()
{
string s;
getline(cin,s);
for(int i=0;i<s.size();i++)
{
if(s[i] == ' ')
{
cout << ' ';
while(s[i+1] == ' ')
{
i++;
}
}
else cout<<s[i];
}
return 0;
}