#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  vector<int> v;
  map<string, int> m;
  stringstream s_stream(s);
  while (s_stream.good()) {
    string substr;
    getline(s_stream, substr, ',');
    m[substr]++;
    if (m[substr] == 1) {
      v.push_back(stoi(substr));
    }
  }
  sort(v.begin(), v.end());
  int n = v.size();
  int j;
  for (int i = 0; i < n; i++) {
    int a = v[i];
    int b = v[i];
    int flg = 0;
    for (j = i + 1; j < n; j++) {
      if (v[j] - v[j - 1] > 1) {
        b = v[j - 1];
        flg = 1;
        break;
      }
    }
    if (flg == 0 || b == v[n - 1] || a == v[n - 1]) {
      if (a != v[n - 1]) {
        cout << a << "-" << v[n - 1];
        exit(0);
      } else {
        cout << a;
        exit(0);
      }
    }
    if (a != b)
      cout << a << "-" << b << ",";
    else
      cout << a << ",";
    i = j - 1;
  }
  return 0;
}
