#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
int tong[1009];
int x, n;
int main() {
  memset(tong, 0, sizeof(tong));
  while (~scanf("%d,", &n)) {
    tong[n] = 1;
  }
  int start, end;
  int flag1 = 0, flag2 = 0;
  for (int i = 1; i <= 1009; i++) {
    if (tong[i]) {
      if (!flag1) start = i;
      end = i;
      flag1 = 1;
    } else {
      if (flag1) {
        if (flag2)
          printf(",");
        else
          flag2 = 1;
        if (start - end + 1 != 1)
          printf("%d-%d", start, end);
        else
          printf("%d", start);
        flag1 = 0;
      }
    }
  }
  printf("\n");
  return 0;
}
