#include <bits/stdc++.h>
using namespace std;
int nextInt() {
  int res = 0;
  char c = getchar();
  if (c == -1) {
    return -1;
  }
  while (c < '0' || c > '9') {
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    res = res * 10 + c - '0';
    c = getchar();
  }
  return res;
}
int main() {
  int x = 1, n, i;
  set<int> mn;
  vector<int> a;
  while ((x = nextInt()) && x != -1) {
    mn.insert(x);
  }
  a.assign(mn.begin(), mn.end());
  n = a.size();
  int k, g;
  for (i = 0; i < n; i++) {
    g = i + 1;
    while (g < n && a[g] == a[g - 1] + 1) {
      g++;
    }
    g--;
    cout << a[i];
    if (g - i > 0) {
      cout << '-' << a[g];
      i += g - i;
    }
    if (i < n - 1) {
      cout << ',';
    }
  }
  return 0;
}
