#include <bits/stdc++.h>
using namespace std;
string toString(int v) {
  if (v == 0) return "0";
  string res;
  while (v) {
    res += (v % 10) + '0';
    v /= 10;
  }
  reverse(res.begin(), res.end());
  return res;
}
int main() {
  string s;
  cin >> s;
  s.insert(0, 1, ',');
  int pos = 0;
  set<int> vals;
  set<int>::iterator it;
  int n = (int)s.size();
  while (pos != n) {
    int curr = s.find(',', pos + 1);
    if (curr == -1) {
      curr = (int)s.size();
    }
    int val = atoi(s.substr(pos + 1, curr - pos - 1).c_str());
    vals.insert(val);
    pos = curr;
  }
  vals.insert(10005000);
  int l = *vals.begin();
  vals.erase(vals.begin());
  int c = l, r;
  vector<string> res;
  while (!vals.empty()) {
    int curr = *vals.begin();
    if (curr == c + 1) {
      c = curr;
    } else {
      if (l != c) {
        res.push_back(toString(l) + "-" + toString(c));
      } else
        res.push_back(toString(c));
      l = c = curr;
    }
    vals.erase(vals.begin());
  }
  for (int i = 0; i < res.size(); ++i) {
    cout << res[i];
    if (i < (int)res.size() - 1) cout << ',';
  }
  return 0;
}
