#include <bits/stdc++.h>
using namespace std;
const int inf = (int)(1e9);
const int mod = inf + 7;
const double pi = acos(-1.0);
const double eps = 1e-9;
string second;
vector<int> v;
string get(string second, int l, int r) {
  string ans = "";
  for (int i = l; i < r; i++) ans += second[i];
  return ans;
}
int toInt(string second) {
  int ans = 0;
  for (int i = 0; i < second.length(); i++) ans = 10 * ans + second[i] - '0';
  return ans;
}
string toString(int n) {
  string ans = "";
  if (n == 0) ans += "0";
  while (n != 0) {
    ans = (char)(n % 10 + 48) + ans;
    n /= 10;
  }
  return ans;
}
int main() {
  getline(cin, second);
  int pos = 0;
  while (pos < second.length()) {
    if (second[pos] == ',')
      pos++;
    else {
      int pos1 = pos;
      while (pos1 < second.length() && second[pos1] != ',') pos1++;
      v.push_back(toInt(get(second, pos, pos1)));
      pos = pos1;
    }
  }
  sort(v.begin(), v.end());
  int n = unique(v.begin(), v.end()) - v.begin();
  string ans = "";
  pos = 0;
  while (pos < n) {
    int pos1 = pos + 1;
    while (pos1 < n && v[pos1] - 1 == v[pos1 - 1]) pos1++;
    pos1--;
    if (pos == pos1) {
      ans += toString(v[pos]) + ",";
    } else {
      ans += toString(v[pos]);
      ans += "-";
      ans += toString(v[pos1]);
      ans += ",";
    }
    pos = pos1 + 1;
  }
  ans.erase(ans.length() - 1);
  cout << ans;
  return 0;
}
