#include <bits/stdc++.h>
int d[1000];
void Qsort(int, int);
bool Checked(int, int);
int main(int argc, char** argv) {
  char a[10000];
  std ::cin >> a;
  int id = 0;
  int k = 0;
  while (a[k] != '\0') {
    int num = 0;
    while ((a[k] != '\0') && (a[k] != ',')) {
      num = (num * 10) + (a[k] - '0');
      k++;
    }
    k++;
    if (Checked(num, id) == true) d[id++] = num;
  }
  bool flag = false;
  Qsort(0, id - 1);
  int cnt = 0;
  int index = 0;
  for (int i = 1; i <= id; i++) {
    if (d[i - 1] + 1 == d[i]) {
      if (cnt == 0) index = i - 1;
      cnt++;
    } else {
      if (cnt != 0) {
        if (flag == true) {
          std ::cout << ',' << d[index] << '-' << d[index + cnt];
        } else {
          std ::cout << d[index] << '-' << d[index + cnt];
          flag = true;
        }
        cnt = 0;
      } else {
        if (flag == true) {
          std ::cout << ',' << d[i - 1];
        } else {
          std ::cout << d[i - 1];
          flag = true;
        }
        cnt = 0;
      }
    }
  }
  if (flag == true) {
    if (cnt != 0) std ::cout << ',' << d[index] << '-' << d[index + cnt];
  } else {
    if (cnt != 0) std ::cout << d[index] << '-' << d[index + cnt];
  }
  return 0;
}
void Qsort(int l, int r) {
  if (l > r) return;
  int i = l;
  int j = r;
  int m = d[(l + r) / 2];
  while (i <= j) {
    while (d[i] < m) i++;
    while (d[j] > m) j--;
    if (i <= j) {
      int temp = d[i];
      d[i] = d[j];
      d[j] = temp;
      i++;
      j--;
    }
  }
  Qsort(l, j);
  Qsort(i, r);
}
bool Checked(int key, int n) {
  for (int i = 0; i < n; i++) {
    if (d[i] == key) return false;
  }
  return true;
}
