#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
void openfile() {
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
}
int main() {
  string s;
  cin >> s;
  s += ',';
  stringstream second(s);
  int x;
  char c;
  set<int> S;
  while (second >> x >> c) S.insert(x);
  vector<int> v((S).begin(), (S).end());
  cout << v[0];
  bool ok = false;
  for (int i = 1; i < v.size(); i++) {
    if (v[i] == v[i - 1] + 1) {
      if (!ok) cout << "-";
      ok = true;
    } else {
      if (ok) cout << v[i - 1];
      cout << "," << v[i];
      ok = false;
    }
  }
  if (ok) cout << v.back();
  cout << endl;
  return 0;
}
