#include <bits/stdc++.h>
using namespace std;
vector<bool> er;
string del(string second, vector<bool>& e, int p1, int p2) {
  string t;
  while (p1 <= p2) {
    if (!e[p1]) t += second[p1];
    ++p1;
  }
  return t;
}
int main() {
  string second;
  getline(cin, second);
  er.assign(second.size(), 0);
  int prob = 0, i = 0, j = second.size() - 1;
  while (i < second.size() && second[i] == ' ') ++i;
  while (j >= 0 && second[j] == ' ') j--;
  int p1 = i, p2 = j;
  while (i <= j) {
    if (second[i] == ' ') {
      prob++;
      er[i] = prob >= 2;
    } else
      prob = 0;
    ++i;
  }
  second = del(second, er, p1, p2);
  er.clear();
  er.assign(second.size(), 0);
  i = 0, j = second.size() - 1;
  while (i < second.size() && second[i] == ' ') ++i;
  while (j >= 0 && second[j] == ' ') j--;
  p1 = i, p2 = j;
  for (int i = 0; i + 1 < second.size(); i++)
    if (second[i] == ' ' && ispunct(second[i + 1])) er[i] = true;
  second = del(second, er, p1, p2);
  er.clear();
  er.assign(second.size(), 0);
  for (int i = 0; i < second.size(); i++)
    if (i + 1 < second.size() && ispunct(second[i]) && second[i + 1] != ' ')
      cout << second[i] << " ";
    else
      cout << second[i];
  return 0;
}
