#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<bool> have(1001, false);
  vector<int> nums;
  bool firsttime = true;
  int n = 0, cur = 0, i;
  string str;
  cin >> str;
  for (i = 0; i < str.size(); i++) {
    if (str[i] == ',') {
      if (!have[cur]) {
        have[cur] = true;
        nums.push_back(cur);
      }
      cur = 0;
    } else {
      cur = cur * 10 + (int)str[i] - (int)'0';
    }
  }
  if (!have[cur]) {
    have[cur] = true;
    nums.push_back(cur);
  }
  sort(nums.begin(), nums.end());
  int st, fn;
  st = nums[0];
  fn = st;
  for (i = 1; i < nums.size(); i++) {
    if (nums[i] == fn + 1) {
      fn++;
    } else {
      if (fn == st) {
        if (!firsttime) {
          cout << "," << st;
        } else {
          cout << st;
        }
        firsttime = false;
      } else {
        if (!firsttime) {
          cout << "," << st << "-" << fn;
        } else {
          cout << st << "-" << fn;
        }
        firsttime = false;
      }
      st = nums[i];
      fn = st;
    }
  }
  if (fn == st) {
    if (!firsttime) {
      cout << "," << st;
    } else {
      cout << st;
    }
    firsttime = false;
  } else {
    if (!firsttime) {
      cout << "," << st << "-" << fn;
    } else {
      cout << st << "-" << fn;
    }
    firsttime = false;
  }
  return 0;
}
