#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vb = vector<bool>;
using vi = vector<int>;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  string s;
  cin >> s;
  int cur = 0;
  set<int> nums;
  for (int i = 0; i < (int)s.size(); ++i) {
    if (s[i] == ',') {
      nums.emplace(cur);
      cur = 0;
    } else {
      cur = cur * 10 + s[i] - '0';
    }
  }
  if (cur) nums.emplace(cur);
  bool first = 1;
  for (auto it = nums.begin(); it != nums.end(); ++it) {
    auto cur = it;
    auto nxt = next(it);
    while (*nxt - 1 == *cur) {
      cur = nxt;
      nxt = next(nxt);
    }
    if (!first) cout << ',';
    cout << *it;
    if (cur != it) cout << "-" << *cur;
    first = 0;
    it = cur;
  }
}
