#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
string s;
getline(cin,s);
deque<char>dq;
for (int i = 0; i < s.size(); ++i){
if(i != 0&& s[i] == ' ' && s[i - 1] != ' ' && s[i - 1] != ',' && s[i - 1] != '.' && s[i - 1] != '!' && s[i - 1] != '?'){
dq.push_back(' ');
}
else if(s[i] >= 'a' && s[i] <= 'z'){
dq.push_back(s[i]);
}
else if(s[i] == ',' || s[i] == '.' || s[i] == '!' || s[i] == '?') {
if (!dq.empty() && dq.back()==' ') {
dq.pop_back();
}
dq.push_back(s[i]);
if (i + 1 < s.size() && s[i + 1] != ' ') {
dq.push_back(' ');
}
}
}
for (char c : dq) {
cout << c;
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpIHsKICAgIGlvczo6c3luY193aXRoX3N0ZGlvKGZhbHNlKTsKICAgIGNpbi50aWUobnVsbHB0cik7CiAgICBjb3V0LnRpZShudWxscHRyKTsKCiAgICBzdHJpbmcgczsKICAgIGdldGxpbmUoY2luLHMpOwogICAgZGVxdWU8Y2hhcj5kcTsKCiAgICBmb3IgKGludCBpID0gMDsgaSA8IHMuc2l6ZSgpOyArK2kpewogICAgICAgIGlmKGkgIT0gMCYmIHNbaV0gPT0gJyAnICYmIHNbaSAtIDFdICE9ICcgJyAmJiBzW2kgLSAxXSAhPSAnLCcgJiYgc1tpIC0gMV0gIT0gJy4nICYmIHNbaSAtIDFdICE9ICchJyAmJiBzW2kgLSAxXSAhPSAnPycpewogICAgICAgICAgICBkcS5wdXNoX2JhY2soJyAnKTsKICAgICAgICB9CiAgICAgICAgZWxzZSBpZihzW2ldID49ICdhJyAmJiBzW2ldIDw9ICd6Jyl7CiAgICAgICAgICAgIGRxLnB1c2hfYmFjayhzW2ldKTsKICAgICAgICB9CiAgICAgICAgZWxzZSBpZihzW2ldID09ICcsJyB8fCBzW2ldID09ICcuJyB8fCBzW2ldID09ICchJyB8fCBzW2ldID09ICc/JykgewogICAgICAgICAgICBpZiAoIWRxLmVtcHR5KCkgJiYgZHEuYmFjaygpPT0nICcpIHsKICAgICAgICAgICAgICAgIGRxLnBvcF9iYWNrKCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZHEucHVzaF9iYWNrKHNbaV0pOwogICAgICAgICAgICBpZiAoaSArIDEgPCBzLnNpemUoKSAmJiBzW2kgKyAxXSAhPSAnICcpIHsKICAgICAgICAgICAgICAgIGRxLnB1c2hfYmFjaygnICcpOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfQoKICAgIGZvciAoY2hhciBjIDogZHEpIHsKICAgICAgICBjb3V0IDw8IGM7CiAgICB9CgogICAgcmV0dXJuIDA7Cn0K