#include <bits/stdc++.h>
using namespace std;
int a[1010];
char s[1010];
int main() {
  int i, n = 0, x = 0;
  scanf("%s", s);
  for (i = 0; s[i]; i++) {
    if (s[i] == ',')
      a[++n] = x, x = 0;
    else
      x = x * 10 + s[i] - '0';
  }
  a[++n] = x;
  sort(a + 1, a + n + 1);
  int l = a[1], r = a[1], flag = 0;
  for (i = 2; i <= n; i++) {
    if (a[i] == r) continue;
    if (a[i] == r + 1)
      r = a[i];
    else {
      if (flag == 0)
        flag = 1;
      else
        printf(",");
      if (l == r)
        printf("%d", l);
      else
        printf("%d-%d", l, r);
      l = a[i];
      r = a[i];
    }
  }
  if (flag == 0)
    flag = 1;
  else
    printf(",");
  if (l == r)
    printf("%d", l);
  else
    printf("%d-%d", l, r);
  printf("\n");
}
