#include <bits/stdc++.h>
using namespace std;
long long numb(string str) {
  long long i, num = 0, len = (int)str.size();
  for (i = 0; i < len; i++) num = (num * 10) + (str[i] - '0');
  return num;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string str, tmp = "";
  vector<long long> vec;
  map<long long, long long> mm;
  long long i, len, temp;
  cin >> str;
  str += ",)";
  len = (int)str.size();
  for (i = 0; i < len; i++) {
    if (str[i] == ')')
      break;
    else if (str[i] == ',') {
      temp = numb(tmp);
      mm[temp]++;
      tmp = "";
    } else
      tmp += str[i];
  }
  for (auto &a : mm) vec.push_back(a.first);
  len = (int)vec.size();
  for (i = 0; i < len - 1; i++) {
    if (vec[i] + 1 != vec[i + 1]) {
      cout << vec[i];
      if (i != len - 1) cout << ",";
    } else if (vec[i] + 1 == vec[i + 1]) {
      cout << vec[i] << "-";
      while (1) {
        i++;
        if (vec[i] + 1 == vec[i + 1] && i < len - 1)
          continue;
        else
          break;
      }
      cout << vec[i];
      if (i != len - 1) cout << ",";
    }
  }
  if (vec[len - 1] - 1 != vec[len - 2]) cout << vec[len - 1];
  return 0;
}
