#include <bits/stdc++.h>
using namespace std;
char in[1000005];
set<int> num;
int main() {
  gets(in);
  int len = strlen(in), now = 0;
  for (int i = 0; i < len; ++i) {
    if (isdigit(in[i]))
      now = now * 10 + in[i] - '0';
    else if (now != 0) {
      num.insert(now);
      now = 0;
    }
  }
  if (now != 0) num.insert(now);
  vector<int> v(num.begin(), num.end());
  vector<pair<int, int> > ans;
  int start = -1, last;
  for (int i = 0; i < v.size(); ++i) {
    if (start == -1) {
      start = last = v[i];
    } else if (v[i] == last + 1)
      last = v[i];
    else {
      ans.push_back(pair<int, int>(start, last));
      start = last = v[i];
    }
  }
  if (start != -1) ans.push_back(pair<int, int>(start, last));
  for (int i = 0; i < ans.size(); ++i) {
    if (i > 0) printf(",");
    if (ans[i].first == ans[i].second)
      printf("%d", ans[i].first);
    else
      printf("%d-%d", ans[i].first, ans[i].second);
  }
  printf("\n");
  return 0;
}
