#include <bits/stdc++.h>
using namespace std;
int main() {
  int num;
  char p;
  vector<int> v;
  vector<int> n[105];
  int x = 0;
  cin >> num;
  v.push_back(num);
  while (scanf("%c,", &p) == 1) {
    if (cin >> num)
      v.push_back(num);
    else
      break;
  }
  sort(v.begin(), v.end());
  n[x].push_back(v[0]);
  for (int i = 1; i < v.size(); i++) {
    if (v[i - 1] == v[i] - 1) {
      n[x].push_back(v[i]);
    } else if (v[i - 1] < v[i]) {
      x++;
      n[x].push_back(v[i]);
    }
  }
  for (int i = 0; i <= x; i++) {
    if (n[i].size() > 1) {
      int t = n[i].size();
      cout << n[i][0] << "-" << n[i][t - 1];
    }
    if (n[i].size() == 1) {
      cout << n[i][0];
    }
    if (i != x) cout << ",";
  }
  cout << endl;
  return 0;
}
