#include <bits/stdc++.h>
using namespace std;
int n, m, i, st, ans = 0;
int gen_num(string s) {
  int k = 0;
  for (int p = 0; s[p]; p++) k = (k * 10) + s[p] - '0';
  return k;
}
int main() {
  vector<int> v;
  map<int, int> taken;
  string s, t = "";
  cin >> s;
  int k;
  for (i = 0; s[i]; i++) {
    if (s[i] == ',') {
      k = gen_num(t);
      if (!taken[k]) v.push_back(k), taken[k] = 1;
      t = "";
    } else
      t += s[i];
  }
  k = gen_num(t);
  if (!taken[k]) v.push_back(k);
  sort(v.begin(), v.end());
  for (i = 1, st = 0; i < v.size(); i++) {
    if (v[i] - v[i - 1] > 1) {
      if (v[st] == v[i - 1])
        cout << v[st];
      else
        cout << v[st] << '-' << v[i - 1];
      cout << ',';
      st = i;
    }
  }
  if (v[st] == v[v.size() - 1])
    cout << v[st];
  else
    cout << v[st] << '-' << v[v.size() - 1];
  return 0;
}
