#include <bits/stdc++.h>
using namespace std;
vector<int> a;
int main() {
  string s;
  cin >> s;
  int cur = 0, mul = 1;
  for (int i = s.length() - 1; i >= 0; --i) {
    if (s[i] == ',') {
      a.push_back(cur);
      mul = 1;
      cur = 0;
    } else {
      cur += mul * (s[i] - 48);
      mul *= 10;
    }
  }
  a.push_back(cur);
  sort(a.begin(), a.end());
  int L;
  int last = a[0];
  bool ok = 0;
  printf("%d", a[0]);
  L = a[0];
  for (int i = 1; i < a.size(); ++i) {
    if (a[i] == last) continue;
    if (a[i] == last + 1) {
      ok = 1;
      last = a[i];
    } else {
      if (ok && L != last) {
        printf("-%d", last);
        L = last;
      }
      last = a[i];
      printf(",%d", a[i]);
      L = a[i];
    }
  }
  if (ok && L != last) printf("-%d", last);
  printf("\n");
  return 0;
}
