#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int i, j, k, l, m, n, strt, f = 0, no;
  string s, sd;
  vector<long long int> v;
  map<long long int, long long int> mp;
  cin >> s;
  n = s.length();
  for (i = 0; i < n; i++) {
    if (s[i] != ',') {
      sd = sd + s[i];
    } else {
      no = stoi(sd);
      if (mp[no] == 0) {
        mp[no]++;
        v.push_back(no);
      }
      sd.clear();
    }
  }
  no = stoi(sd);
  if (mp[no] == 0) {
    v.push_back(no);
  }
  sort(v.begin(), v.end());
  for (i = 0; i < v.size(); i++) {
    if (i + 1 < v.size() && v[i] + 1 == v[i + 1]) {
      if (f == 0) {
        strt = v[i];
        f = 1;
      }
    } else {
      if (f == 1 && i != v.size() - 1) cout << strt << "-" << v[i] << ",";
      if (f == 1 && i == v.size() - 1) cout << strt << "-" << v[i];
      if (f == 0 && i != v.size() - 1) cout << v[i] << ",";
      if (f == 0 && i == v.size() - 1) cout << v[i];
      f = 0;
    }
  }
}
