#include <bits/stdc++.h>
int main() {
  static char s[1024], good[1000 + 1], *t, cc[1048576], *p = cc;
  int k, l, r, first;
  scanf("%s", s);
  k = 0;
  for (t = strtok(s, ","); t != NULL; t = strtok(NULL, ",")) good[atoi(t)] = 1;
  first = 1;
  for (l = 1; l <= 1000; l = r) {
    while (l <= 1000 && !good[l]) l++;
    r = l + 1;
    while (r <= 1000 && good[r]) r++;
    if (l <= 1000) {
      if (!first) p += sprintf(p, ",");
      first = 0;
      p += sprintf(p, "%d", l);
      if (l < r - 1) p += sprintf(p, "-%d", r - 1);
    }
  }
  printf("%s\n", cc);
  return 0;
}
