#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string a;
  cin >> a;
  vector<string> q;
  string w = "";
  for (int i = 0; i < a.size(); i++) {
    if (a[i] != ',') {
      w += a[i];
    } else {
      q.push_back(w);
      w = "";
    }
  }
  if (w.size() != 0) {
    q.push_back(w);
  }
  vector<int> e;
  for (int i = 0; i < q.size(); i++) {
    vector<int> r;
    for (int j = 0; j < q[i].size(); j++) {
      r.push_back(q[i][j] - '0');
    }
    if (r.size() == 1) {
      e.push_back(r[0]);
    }
    if (r.size() == 2) {
      e.push_back(r[0] * 10 + r[1]);
    }
    if (r.size() == 3) {
      e.push_back(r[0] * 100 + 10 * r[1] + r[2]);
    }
    if (r.size() == 4) {
      e.push_back(r[0] * 1000 + r[1] * 100 + r[2] * 10 + r[3]);
    }
  }
  if (e.size() == 1) {
    cout << e[0];
    return 0;
  }
  sort(e.begin(), e.end());
  int t = e[0];
  ;
  int s = e[0];
  e.push_back(10000);
  for (int i = 1; i < e.size(); i++) {
    if (e[i] - 1 == t) {
      t = e[i];
      continue;
    }
    if (e[i] - 1 > t) {
      if (s == t) {
        if (e[i] == 10000) {
          cout << s;
        } else {
          cout << s << ",";
        }
        s = e[i];
        t = e[i];
      } else {
        if (e[i] == 10000) {
          cout << s << "-" << t;
        } else {
          cout << s << "-" << t << ",";
        }
        s = e[i];
        t = e[i];
      }
    }
  }
  return 0;
}
