#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, i, j, k;
  set<long long> st;
  while (scanf("%lld,", &k) != EOF) {
    st.insert(k);
  }
  vector<long long> v;
  for (auto it = st.begin(); it != st.end(); ++it) {
    v.push_back(*it);
  }
  cout << v[0];
  long long p = 0;
  for (long long i = 1; i <= v.size() - 1; i++) {
    long long f = 0;
    if (v[i] - 1 == v[i - 1] && p == 0) {
      cout << "-";
      p = 1;
    } else if (v[i] - 1 != v[i - 1]) {
      cout << "," << v[i];
      f = 1;
    }
    if (v[i] - 1 == v[i - 1] && p == 1 &&
        (v[i] + 1 != v[i + 1] || i == v.size() - 1)) {
      cout << v[i];
      p = 0;
    } else if (v[i] - 1 != v[i - 1] && p == 0 && f == 0 &&
               (v[i] + 1 == v[i + 1] || i == v.size() - 1)) {
      cout << "," << v[i];
      p = 0;
    }
  }
  cout << endl;
  return 0;
}
