#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483647;
const double PI = 3.141592653589793;
set<int> zbior;
set<int>::iterator it;
string s;
char t[1000000];
int last, pocz, i, a;
bool bylo;
int main() {
  scanf("%s", &t);
  s = t;
  i = 0;
  zbior.clear();
  while (i < s.size()) {
    a = 0;
    while (i < s.size() && s[i] != ',') {
      a = a * 10 + int(s[i]) - 48;
      i++;
    }
    zbior.insert(a);
    i++;
  }
  last = -10;
  bylo = false;
  for (it = zbior.begin(); it != zbior.end(); it++) {
    if (last < 0) {
      last = pocz = *it;
    } else if (*it != last + 1) {
      if (bylo)
        printf(",");
      else
        bylo = true;
      if (pocz == last)
        printf("%d", pocz);
      else
        printf("%d-%d", pocz, last);
      pocz = *it;
    }
    last = *it;
  }
  if (bylo)
    printf(",");
  else
    bylo = true;
  if (pocz == last)
    printf("%d", pocz);
  else
    printf("%d-%d", pocz, last);
  printf("\n");
  return 0;
}
