#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int n = s.size();
  set<int> v;
  for (int i = 0; i < n; ++i) {
    string num = "";
    while (i < n && s[i] != ',') num += s[i], i++;
    int x = 0;
    reverse(num.begin(), num.end());
    for (int j = 0; j < num.size(); ++j) {
      x += int(num[j] - '0') * pow(10, j);
    }
    v.insert(x);
  }
  auto it = v.begin();
  while (it != v.end()) {
    cout << *it;
    int x = *it;
    auto it2 = it;
    it2++;
    while (*it2 - *it == 1 && it2 != v.end()) {
      it++;
      it2++;
    }
    if (*it != x) cout << '-' << *it;
    it++;
    if (it != v.end()) cout << ',';
  }
}
