#include <iostream>
#include <string>
using namespace std;
int main()
{
string encrypted, decrypted;
while (getline(cin,encrypted))
{
int j = 0;
int n = 0;
if (encrypted.size() == 1)
{
cout << encrypted << endl;
encrypted.clear();
continue;
}
while (encrypted[n] != ' ')
{
n++;
j++;
}
for (int i = 0,t=0;i < n;i++)
{
decrypted += encrypted[i];
t++;
if ((encrypted[j] == ' ') && (encrypted[j + 1] == ' ')&&(j<encrypted.length()-1))
{
decrypted += ' ';
t++;
++j;
continue;
}
else if (encrypted[j] == ' ') { j++; }
while ((encrypted[j] != ' ')&&(j<encrypted.length()))
{
decrypted += encrypted[j];
t++;
j++;
}
decrypted += ' ';
}
while(decrypted.back() == ' ')decrypted.erase(decrypted.end()-1);
cout << decrypted << endl;
decrypted.clear();
}
return 0;
}
ICAgICNpbmNsdWRlIDxpb3N0cmVhbT4KICAgICNpbmNsdWRlIDxzdHJpbmc+CiAgICB1c2luZyBuYW1lc3BhY2Ugc3RkOwogICAgIAogICAgaW50IG1haW4oKQogICAgewogICAgCXN0cmluZyBlbmNyeXB0ZWQsIGRlY3J5cHRlZDsKICAgIAl3aGlsZSAoZ2V0bGluZShjaW4sZW5jcnlwdGVkKSkKICAgIAl7CiAgICAJCWludCBqID0gMDsKICAgIAkJaW50IG4gPSAwOwogICAgCQlpZiAoZW5jcnlwdGVkLnNpemUoKSA9PSAxKQogICAgCQl7CiAgICAJCQljb3V0IDw8IGVuY3J5cHRlZCA8PCBlbmRsOwogICAgCQkJZW5jcnlwdGVkLmNsZWFyKCk7CiAgICAJCQljb250aW51ZTsKICAgIAkJfQogICAgCQl3aGlsZSAoZW5jcnlwdGVkW25dICE9ICcgJykgCiAgICAJCXsKICAgIAkJCW4rKzsKICAgIAkJCWorKzsKICAgIAkJfQogICAgCQlmb3IgKGludCBpID0gMCx0PTA7aSA8IG47aSsrKQogICAgCQl7CiAgICAJCQlkZWNyeXB0ZWQgKz0gZW5jcnlwdGVkW2ldOwogICAgCQkJdCsrOwogICAgCQkJaWYgKCh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