#include <bits/stdc++.h>
using namespace std;
const long long maxn = 3e5 + 10;
char str[maxn];
long long N;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> str + 1;
  N = strlen(str + 1);
  long long pos = 1;
  vector<long long> v;
  while (pos <= N) {
    long long num = 0;
    while (pos <= N && str[pos] != ',') {
      num = num * 10 + str[pos] - '0';
      ++pos;
    }
    ++pos;
    v.push_back(num);
  }
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  vector<pair<long long, long long> > stk;
  for (long long i = 0; i < v.size(); ++i) {
    if (stk.empty() || stk.back().second + 1 != v[i]) {
      stk.push_back({v[i], v[i]});
    } else {
      pair<long long, long long> top = stk.back();
      stk.pop_back();
      stk.push_back({top.first, top.second + 1});
    }
  }
  for (long long i = 0; i < stk.size(); ++i) {
    pair<long long, long long> now = stk[i];
    if (now.first == now.second) {
      cout << now.first;
    } else {
      cout << now.first << "-" << now.second;
    }
    if (i == (long long)stk.size() - 1) {
      cout << endl;
    } else {
      cout << ",";
    }
  }
  return 0;
}
