#include <bits/stdc++.h>
using namespace std;
vector<int> split(string s) {
  vector<int> xs;
  stringstream ss(s);
  string item;
  while (getline(ss, item, ',')) {
    xs.push_back(stoi(item));
  }
  return xs;
}
int main() {
  string s;
  getline(cin, s);
  vector<int> xxs = split(s);
  sort(xxs.begin(), xxs.end());
  vector<pair<int, int>> sol;
  for (int i = 0; i < xxs.size(); i++) {
    int st = xxs[i];
    int e = st;
    while (i < xxs.size() - 1 && (e + 1 == xxs[i + 1] || e == xxs[i + 1])) {
      e = xxs[i + 1];
      i++;
    }
    sol.push_back(make_pair(st, e));
  }
  for (int i = 0; i < sol.size(); i++) {
    if (sol[i].first != sol[i].second) {
      cout << sol[i].first << "-" << sol[i].second;
    } else {
      cout << sol[i].first;
    }
    if (i != sol.size() - 1) {
      cout << ",";
    }
  }
  return 0;
}
