#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  vector<int> v1;
  unordered_map<int, int> m1;
  int rr = 0;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == ',') {
      if (m1[rr] == 0 && rr > 0) {
        v1.push_back(rr);
        m1[rr] += 10;
      }
      rr = 0;
    } else {
      rr = rr * 10 + (s[i] - 48);
    }
  }
  if (rr > 0 && m1[rr] == 0) v1.push_back(rr);
  sort(v1.begin(), v1.end());
  int ctr = 1;
  vector<int> v2;
  int prev = v1[0];
  int n = v1.size();
  for (int i = 1; i < n; i++) {
    if ((v1[i] - 1) == prev) {
      ctr++;
    } else {
      if (ctr >= 3) {
        v2.push_back(v1[i - 1] - ctr + 1);
        v2.push_back(0);
        v2.push_back(v1[i - 1]);
      } else {
        if (ctr == 1) {
          v2.push_back(v1[i - 1]);
        } else if (ctr == 2) {
          v2.push_back(v1[i - 2]);
          v2.push_back(0);
          v2.push_back(v1[i - 1]);
        }
      }
      ctr = 1;
    }
    prev = v1[i];
  }
  int i = n;
  if (ctr >= 3) {
    v2.push_back(v1[i - 1] - ctr + 1);
    v2.push_back(0);
    v2.push_back(v1[i - 1]);
  } else {
    if (ctr == 1) {
      v2.push_back(v1[i - 1]);
    } else if (ctr == 2) {
      v2.push_back(v1[i - 2]);
      v2.push_back(0);
      v2.push_back(v1[i - 1]);
    }
  }
  for (int i = 0; i < v2.size(); i++) {
    if (v2[i] == 0)
      cout << "-";
    else
      cout << v2[i];
    if (v2[i] != 0 && i != v2.size() - 1) {
      if (v2[i + 1] != 0) cout << ",";
    }
  }
}
