#include <bits/stdc++.h>
using namespace std;
char str[100010];
int main() {
  char c[10];
  int a[128];
  int i = 0;
  int j = 0;
  cin >> str;
  int k = 0;
  memset(c, 0, sizeof(c));
  while (str[i] != '\0') {
    if (str[i] != ',') {
      c[j++] = str[i++];
    } else {
      sscanf(c, "%d", &a[k++]);
      j = 0;
      i++;
      memset(c, 0, sizeof(c));
    }
  }
  sscanf(c, "%d", &a[k]);
  int n = k;
  sort(a, a + n + 1);
  vector<int> seq;
  int l = a[0], r = a[0];
  for (int i = 1; i <= n; i++) {
    if (a[i] - a[i - 1] > 1) {
      seq.push_back(l);
      seq.push_back(r);
      r = a[i];
      l = a[i];
    } else {
      r = a[i];
    }
  }
  seq.push_back(l);
  seq.push_back(r);
  for (int i = 0; i <= seq.size() - 2;) {
    if (seq[i] == seq[i + 1]) {
      printf("%d", seq[i]);
      if (i + 4 <= seq.size()) {
        printf(",");
      }
    } else {
      printf("%d-%d", seq[i], seq[i + 1]);
      if (i + 4 <= seq.size()) {
        printf(",");
      }
    }
    i += 2;
  }
  return 0;
}
