#include <bits/stdc++.h>
using namespace std;
using int64 = int64_t;
class Task {
 private:
  int n;
  vector<string> text;
  bool is_mark(char ch) {
    return ch == '.' || ch == ',' || ch == '!' || ch == '?';
  }
  vector<deque<char>> normalize(string &v) {
    int m = (int)v.size();
    vector<deque<char>> ans;
    deque<char> tmp;
    for (int i = 0; i < m; ++i) {
      char ch = v[i];
      if (is_mark(ch)) {
        ans.push_back(tmp);
        tmp.clear();
        tmp.push_back(ch);
      } else if (ch == ' ') {
        ans.push_back(tmp);
        tmp.clear();
      } else {
        tmp.push_back(ch);
      }
    }
    if (tmp.size()) ans.push_back(tmp);
    return ans;
  }
  void solveOne(istream &in, ostream &out) {
    string word;
    getline(cin, word);
    vector<deque<char>> txt = normalize(word);
    n = (int)txt.size();
    for (int i = 1; i < n; ++i) {
      while (txt[i - 1].size() && txt[i - 1].front() == ' ') {
        txt[i - 1].pop_front();
      }
      while (txt[i - 1].size() && txt[i - 1].back() == ' ') {
        txt[i - 1].pop_back();
      }
      while (txt[i].size() && txt[i].front() == ' ') {
        txt[i].pop_front();
      }
      while (txt[i].size() && txt[i].back() == ' ') {
        txt[i].pop_back();
      }
      if (txt[i].size() && is_mark(txt[i].front())) {
        txt[i - 1].push_back(txt[i].front());
        txt[i].pop_front();
      }
      while (txt[i - 1].size() && txt[i - 1].front() == ' ') {
        txt[i - 1].pop_front();
      }
      while (txt[i - 1].size() && txt[i - 1].back() == ' ') {
        txt[i - 1].pop_back();
      }
      while (txt[i].size() && txt[i].front() == ' ') {
        txt[i].pop_front();
      }
      while (txt[i].size() && txt[i].back() == ' ') {
        txt[i].pop_back();
      }
    }
    for (int i = 0; i < (int)txt.size(); ++i) {
      if (txt[i].size() == 0) continue;
      if (i == 0) {
        string s = "";
        for (char ch : txt[i]) {
          s.push_back(ch);
        }
        cout << s;
      } else {
        string s = "";
        for (char ch : txt[i]) {
          s.push_back(ch);
        }
        if (s.size() == 1 && is_mark(s[0]))
          cout << s;
        else
          cout << " " << s;
      }
    }
    cout << '\n';
  }

 public:
  void solve(istream &in, ostream &out) {
    int t = 1;
    while (t--) solveOne(in, out);
  }

 private:
  void print() { cout << "\n"; }
  template <class H, class... T>
  void print(const H &h, const T &...t) {
    cout << h;
    if (sizeof...(t)) cout << ' ';
    print(t...);
  }
};
auto main() -> int {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  Task solver;
  istream &in(cin);
  ostream &out(cout);
  solver.solve(in, out);
  return 0;
}
