#include <bits/stdc++.h>
using namespace std;
int main() {
  char a[10004];
  int i, j, k, l, m, n, ji = 0;
  while (gets(a)) {
    l = strlen(a);
    k = 0;
    ji = 0;
    for (i = 0; i < l; i++) {
      if (a[i] == ' ') {
        k++;
      } else if (a[i] == '.' || a[i] == '?' || a[i] == '!' || a[i] == ',') {
        if (k != 0) {
          k = 0;
        }
        cout << a[i];
        if (i != l - 1) {
          cout << " ";
          ji = 1;
        }
      } else if (a[i] != ' ') {
        if (k != 0) {
          k = 0;
          if (ji != 1) {
            cout << " ";
            ji = 0;
          }
        }
        cout << a[i];
        ji = 0;
      }
    }
    cout << "\n";
  }
  return 0;
}
