#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i++)
    if (s[i] == ',') s[i] = ' ';
  stringstream ss;
  ss << s;
  int x;
  set<int> se;
  while (ss >> x) se.insert(x);
  vector<int> vec(se.begin(), se.end());
  for (int i = 0; i < vec.size(); i++) {
    if (i) cout << ",";
    int j = i + 1;
    while (j < vec.size() && vec[j] == vec[j - 1] + 1) j++;
    if (j - i == 1)
      cout << vec[i];
    else
      cout << vec[i] << "-" << vec[j - 1];
    i = j - 1;
  }
  cout << endl;
  return 0;
}
