#include <bits/stdc++.h>
using namespace std;
bool isPunct(char c) { return c == '!' or c == ',' or c == '.' or c == '?'; }
int main() {
  stack<char> s;
  while (!cin.fail()) {
    char c = cin.get();
    if (c == '\n') break;
    if (s.empty()) {
      s.push(c);
      if (isPunct(c)) s.push(' ');
    } else if (s.top() == ' ' and c == ' ')
      continue;
    else if (isPunct(c)) {
      while (!s.empty() and s.top() == ' ') s.pop();
      if (isPunct(s.top()))
        s.push(' '), s.push(c);
      else
        s.push(c), s.push(' ');
    } else
      s.push(c);
  }
  string ss;
  while (!s.empty()) ss += s.top(), s.pop();
  for (int i = ss.size() - 1; i > -1; --i) cout << ss[i];
  cout << endl;
}
