#include <bits/stdc++.h>
using namespace std;
vector<int> Num;
void Convert(string s) {
  stringstream ss;
  int n;
  string w = "";
  for (int i = 0; i < (int)s.size(); i++) {
    if (s[i] != ',') {
      w += s[i];
      if (i == (int)s.size() - 1) {
        ss << w;
        ss >> n;
        ss.clear();
        Num.push_back(n);
        w = "";
      }
    } else {
      ss << w;
      ss >> n;
      ss.clear();
      Num.push_back(n);
      w = "";
    }
  }
}
void Sort(vector<int>& a, int n) {
  int i = n / 2, k, t;
  while (i) {
    for (int j = i; j < n; j++) {
      k = j;
      t = a[j];
      while (k >= i && t < a[k - i]) a[k] = a[k - i], k -= i;
      a[k] = t;
    }
    i /= 2;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL), cout.tie(NULL);
  string s;
  cin >> s;
  Convert(s);
  set<int> st;
  vector<int> v;
  Sort(Num, (int)Num.size());
  for (int i = 0; i < (int)Num.size(); i++) st.insert(Num[i]);
  set<int>::iterator it;
  for (it = st.begin(); it != st.end(); it++) v.push_back(*it);
  int a, b;
  bool ok = 0;
  for (int i = 0; i < (int)v.size(); i++) {
    if (v[i + 1] - v[i] == 1 && i + 1 != (int)v.size()) {
      a = v[i];
      b = v[i + 1];
      for (int j = i + 1; j < (int)v.size(); j++) {
        if (v[j] - v[j - 1] == 1) {
          b = v[j];
          if (j == (int)v.size() - 1) i = j;
        } else {
          i = j - 1;
          break;
        }
      }
      if (ok) cout << ',';
      cout << a << '-' << b;
      ok = 1;
    } else {
      if (ok) cout << ',';
      cout << v[i];
      ok = 1;
    }
  }
}
