#include <bits/stdc++.h>
using namespace std;
struct node {
  int ff, tt;
};
char str[222];
int a[105];
vector<node> v;
set<int> ss;
int main() {
  cin >> str;
  int i, j;
  int tm = 0;
  int cnt = 0;
  for (i = 0; str[i]; i++) {
    if (str[i] == ',') {
      ss.insert(tm);
      tm = 0;
      continue;
    }
    tm = tm * 10 + str[i] - '0';
  }
  ss.insert(tm);
  v.clear();
  set<int>::iterator it;
  j = 0;
  for (it = ss.begin(); it != ss.end(); it++) {
    a[j++] = *(it);
  }
  int s = 0, t;
  node tmp;
  for (i = 1; i < j; i++) {
    if (a[i] - a[i - 1] != 1) {
      tmp.ff = s;
      tmp.tt = i - 1;
      v.push_back(tmp);
      s = i;
    }
  }
  tmp.ff = s;
  tmp.tt = j - 1;
  v.push_back(tmp);
  if (v[0].ff == v[0].tt) {
    cout << a[v[0].ff];
  } else if (v[0].ff != v[0].tt) {
    cout << a[v[0].ff] << "-" << a[v[0].tt];
  }
  for (i = 1; i < v.size(); i++) {
    if (v[i].ff == v[i].tt) {
      cout << "," << a[v[i].ff];
    } else if (v[i].ff != v[i].tt) {
      cout << "," << a[v[i].ff] << "-" << a[v[i].tt];
    }
  }
  return 0;
}
