#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[100010];
  int b[100010];
  while (scanf("%d", &a[0]) != EOF) {
    getchar();
    int n = 1;
    while (scanf("%d", &a[n]) != EOF) {
      n++;
      getchar();
    }
    sort(a, a + n);
    a[n] = 9999999;
    int h = 0;
    for (int i = 0; i < n; i++) {
      if (i == 0) {
        b[h++] = a[i];
      } else if (a[i] != a[i - 1]) {
        b[h++] = a[i];
      }
    }
    b[h] = 99999;
    int p = b[0];
    int q = b[0];
    int flag = 0;
    int ff = 0;
    for (int i = 1; i <= h; i++) {
      if (b[i] == b[i - 1] + 1) {
        p = b[i];
      } else if (b[i] != b[i - 1] + 1) {
        ff = 1;
        if (flag == 1) {
          printf(",");
        }
        flag = 1;
        if (p == q) {
          printf("%d", p);
        } else {
          printf("%d-%d", q, p);
        }
        p = b[i];
        q = b[i];
      }
    }
    printf("\n");
  }
  return 0;
}
