#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const int sz = 1e7 + 4;
const signed long long int MIN = numeric_limits<signed long long int>::min();
int a[10000];
int main() {
  int n;
  for (int i = 0;; i++) {
    int tmp = scanf("%d,", &a[i]);
    if (tmp != 1) {
      n = i;
      break;
    }
  }
  sort(a, a + n);
  n = unique(a, a + n) - a;
  int c = 0;
  for (int i = 0; i < n;) {
    int j = i;
    for (; j < n && (i == j || a[j] == a[j - 1] + 1); j++)
      ;
    if (i == j - 1) {
      if (c) {
        cout << ",";
      }
      c = 1;
      cout << a[i];
    } else {
      if (c) {
        cout << ",";
      }
      c = 1;
      cout << a[i] << "-" << a[j - 1];
    }
    i = j;
  }
  return 0;
}
