#include <bits/stdc++.h>
using namespace std;
int a[1010];
bool b[1010];
int main() {
  bool H = false;
  int st, en, n = 0, num = 0, x = 0;
  string s;
  cin >> s;
  s += ',';
  for (int i = 0; i < s.length(); ++i) {
    if (s[i] == ',') {
      a[n] = num;
      num = 0;
      ++n;
    } else {
      num *= 10;
      num += s[i] - '0';
    }
  }
  for (int i = n - 1; i >= 0; --i) {
    b[a[i]] = true;
  }
  for (int i = 10000; i >= 0; --i)
    if (b[i]) x = i;
  st = x;
  for (int i = x; i < 1005; ++i) {
    if (b[i] == false) {
      en = i - 1;
      if (st != en) {
        if (H) cout << ",";
        cout << (st) << '-' << (en);
        H = true;
      } else {
        if (H) cout << ",";
        cout << (st);
        H = true;
      }
      while (b[i] == false) i++;
      st = i;
    }
  }
  return 0;
}
