#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int maxx = 0;
  int n = s.length();
  bool d[2001];
  memset(d, false, sizeof(d));
  string tmp = "";
  for (int i = 0; i < n; i++)
    if (s[i] != ',') {
      tmp += s[i];
      maxx = max(maxx, stoi(tmp));
    } else {
      int x = stoi(tmp);
      maxx = max(x, maxx);
      if (!d[x]) d[x] = true;
      tmp = "";
    }
  d[stoi(tmp)] = true;
  int t = 0;
  bool f = false;
  while (t <= maxx) {
    if (!d[t]) {
      t++;
      continue;
    }
    int cnt = t;
    while (d[cnt]) cnt++;
    if (cnt > t + 1) {
      if (f) cout << ',';
      cout << t << "-" << cnt - 1;
      t = cnt;
      f = true;
      continue;
    } else {
      if (f) cout << ',';
      cout << cnt - 1;
      t++;
      f = true;
    }
  }
  return 0;
}
