#include <bits/stdc++.h>
int n, a[100000];
int main() {
  int n = 0;
  while (scanf("%d,", &a[n]) == 1) n++;
  std::sort(a, a + n);
  int i = 0, l, r;
  while (i < n) {
    l = a[i];
    i++;
    while (i < n && (a[i] == a[i - 1] || a[i] == a[i - 1] + 1)) i++;
    if (a[i - 1] != l)
      printf("%d-%d", l, a[i - 1]);
    else
      printf("%d", l);
    if (i < n) printf(",");
  }
}
