#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  vector<int> v;
  cin >> a;
  v.push_back(a);
  while (scanf(",%d", &a)) {
    v.push_back(a);
  }
  int tap = 0, b = 0;
  sort(v.begin(), v.end());
  for (int i = 0; i < v.size(); i++) {
    tap++;
    if (i != v.size() - 1 && v[i] != v[i + 1] - 1 && v[i] != v[i + 1]) {
      if (tap == 1) {
        cout << v[i];
        b = i + 1;
        tap = 0;
        if (i != v.size() - 1)
          cout << ",";
        else
          cout << "\n";
      } else {
        if (v[b] == v[i])
          cout << v[i];
        else
          cout << v[b] << "-" << v[i];
        b = i + 1;
        tap = 0;
        if (i != v.size() - 1)
          cout << ",";
        else
          cout << "\n";
      }
    } else if (i == v.size() - 1) {
      if (v[b] == v[i])
        cout << v[i];
      else
        cout << v[b] << '-' << v[i];
    }
  }
}
