#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {
  int ret;
  stringstream ss(s);
  ss >> ret;
  return ret;
}
int main() {
  set<int> S;
  string line;
  cin >> line;
  int prev = 0;
  for (size_t i = 0; i < line.size(); ++i) {
    if (line[i] == ',') {
      S.insert(toInt(line.substr(prev, i - prev)));
      prev = i + 1;
    }
  }
  S.insert(toInt(line.substr(prev)));
  vector<int> v(S.begin(), S.end());
  prev = 0;
  for (int i = 1; i < (int)v.size(); ++i) {
    while (v[i] - v[prev] == i - prev) ++i;
    if (v[prev] == v[i - 1])
      cout << v[prev];
    else
      cout << v[prev] << "-" << v[i - 1];
    prev = i;
    --i;
    if (i != (int)v.size() - 1) cout << ",";
  }
  if (v.size() == 1) cout << v[0];
  cout << endl;
  return 0;
}
