#include <bits/stdc++.h>
using namespace std;
class Solution {
 public:
  string solve(string& s) {
    int n = s.length();
    auto split = [&](string& s, const string& delimiters = " .,!?    :;") {
      vector<string> res;
      int n = s.length();
      for (int i = 0; i < n; ++i) {
        auto j = s.find_first_of(delimiters, i);
        if (j == string::npos) {
          j = n;
        }
        if (j > i) {
          res.emplace_back(s.substr(i, j - i));
        }
        i = j;
      }
      return res;
    };
    auto S = split(s);
    vector<int> A;
    for (auto& t : S) {
      A.push_back(stoi(t));
    }
    sort(A.begin(), A.end());
    A.resize(unique(A.begin(), A.end()) - A.begin());
    string res;
    int m = A.size();
    for (int i = 0; i < m; ++i) {
      int l = A[i];
      while (i + 1 < n && A[i + 1] == A[i] + 1) {
        ++i;
      }
      int r = A[i];
      if (!res.empty()) {
        res += ',';
      }
      if (l == r) {
        res += to_string(l);
      } else {
        res += to_string(l);
        res += '-';
        res += to_string(r);
      }
    }
    return res;
  }
};
int main(int argc, char** argv) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  Solution sol;
  string s;
  cin >> s;
  cout << sol.solve(s) << '\n';
  return 0;
}
