#include <bits/stdc++.h>
using namespace std;
int64_t a[1050];
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  while (1) {
    int64_t x = s.find(',');
    if (x == string::npos) break;
    a[stoll(s.substr(0, x))] = 1;
    s.erase(0, x + 1);
  }
  a[stoll(s)] = 1;
  vector<int64_t> v;
  vector<string> ans;
  for (int64_t i = 0; i < 1050; ++i) {
    if (a[i]) {
      v.push_back(i);
    } else {
      if ((int64_t)(v).size() == 1) {
        ans.push_back(to_string(v.front()));
      } else if ((int64_t)(v).size() > 1) {
        ans.push_back(to_string(v.front()) + "-" + to_string(v.back()));
      }
      v.clear();
    }
  }
  s.clear();
  for (auto& x : ans) s += x + ',';
  s.erase((int64_t)(s).size() - 1, 1);
  cout << s;
}
