#include <bits/stdc++.h>
using namespace std;
bool isPrep(char p) {
  switch (p) {
    case '.':
    case ',':
    case '!':
    case '?':
      return true;
  }
  return false;
}
int main() {
  char pcs[20000];
  char out[20001] = {0};
  string str = string("");
  cin.getline(pcs, 20000);
  str = string(pcs);
  size_t sz = str.size();
  const char* ps = str.c_str();
  int cnt = 1, curo = 0;
  for (size_t i = 0; i < sz; ++i) {
    char pc = *ps;
    switch (pc) {
      case '.':
      case ',':
      case '!':
      case '?':
        if (curo > 0 && *(ps - 1) == ' ') {
          ++ps;
          out[curo - 1] = pc;
          out[curo] = ' ';
          ++cnt;
        } else if (i < sz - 1 && !isPrep(*(ps + 1))) {
          ++ps;
          out[curo] = pc;
          ++curo;
          out[curo] = ' ';
          ++cnt;
        } else {
          ++ps;
          cnt = 0;
          out[curo] = pc;
        }
        break;
      case ' ':
        ++ps;
        if (cnt > 0) continue;
        ++cnt;
        out[curo] = pc;
        break;
      default:
        ++ps;
        cnt = 0;
        out[curo] = pc;
        break;
    }
    ++curo;
  }
  if (out[curo - 1] == ' ') out[curo - 1] = 0;
  out[curo] = 0;
  cout << out;
  return 0;
}
