#include <bits/stdc++.h>
using namespace std;
int a[1000];
int main() {
  char c;
  int tmp = 0;
  int k = 0;
  while (cin >> c) {
    if (c != ',') {
      tmp += c - '0';
      tmp *= 10;
    } else {
      tmp /= 10;
      a[k++] = tmp;
      tmp = 0;
    }
  }
  a[k++] = tmp / 10;
  sort(a, a + k);
  int l, r;
  l = r = a[0];
  for (int i = 1; i < k; i++) {
    if (a[i] == r) {
      continue;
    } else if (a[i] == r + 1) {
      r++;
    } else {
      cout << l;
      if (r != l) {
        cout << "-" << r;
      }
      cout << ",";
      l = r = a[i];
    }
  }
  cout << l;
  if (r != l) {
    cout << "-" << r;
  }
  return 0;
}
