#include <bits/stdc++.h>
bool m[1001];
int r[101];
int l[101];
int p = 0;
int main() {
  int a;
  while (scanf("%d,", &a) != EOF) {
    m[a] = true;
  }
  int j = 0;
  while (true) {
    if (m[j]) {
      r[p] = l[p] = j;
      break;
    }
    j++;
  }
  for (int i = j + 1; i < 1001; i++) {
    if (m[i]) {
      if (r[p] + 1 == i)
        r[p] = i;
      else {
        p++;
        r[p] = l[p] = i;
      }
    }
  }
  for (j = 0; j < p; j++) {
    if (r[j] == l[j])
      printf("%d,", r[j]);
    else
      printf("%d-%d,", l[j], r[j]);
  }
  if (r[p] == l[p])
    printf("%d", r[p]);
  else
    printf("%d-%d", l[p], r[p]);
  return 0;
}
