#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> v;
  int p;
  while (cin >> p) {
    v.push_back(p);
    char tmp;
    cin >> tmp;
  }
  sort(v.begin(), v.end());
  int index = 0;
  bool flag = false;
  while (index < v.size()) {
    int index_backup = index;
    while (index + 1 < v.size() &&
           (v[index] + 1 == v[index + 1] || v[index] == v[index + 1]))
      ++index;
    if (flag)
      cout << ',';
    else
      flag = true;
    if (v[index] == v[index_backup])
      cout << v[index];
    else
      cout << v[index_backup] << '-' << v[index];
    ++index;
  }
  cout << endl;
  return 0;
}
