#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
const int oo = 0x3f3f3f3f;
const long long ooLL = 0x3f3f3f3f3f3f3f3fLL;
int main() {
  set<int> p;
  for (int x; scanf("%d%*c", &x) == 1; p.insert(x))
    ;
  int pp = -10;
  int pf = -10;
  p.insert(10000);
  bool f = true;
  for (set<int>::const_iterator it = p.begin(); it != p.end(); ++it) {
    if (pp < 0) {
      pp = pf = *it;
    } else if (*it == pp + 1) {
      ++pp;
    } else {
      if (!f) printf(",");
      f = false;
      if (pp == pf)
        printf("%d", pp);
      else
        printf("%d-%d", pf, pp);
      pp = pf = *it;
    }
  }
  return 0;
}
