#include <bits/stdc++.h>
using namespace std;
const int Inf = (int)1e10;
int main() {
  ios_base::sync_with_stdio(false);
  string s;
  cin >> s;
  s += ",";
  vector<int> nums;
  int acc = 0;
  for (int i = 0; i < s.length(); i++)
    if (s[i] == ',') {
      nums.push_back(acc);
      acc = 0;
    } else {
      acc = 10 * acc + s[i] - '0';
    }
  nums.push_back(100000);
  sort(nums.begin(), nums.end());
  int start = nums[0];
  int last = start;
  for (int i = 1; i < nums.size(); i++)
    if (nums[i] == last)
      continue;
    else if (nums[i] == last + 1)
      last++;
    else {
      if (start == last)
        cout << start;
      else
        cout << start << '-' << last;
      if (i < nums.size() - 1) cout << ',';
      start = last = nums[i];
    }
}
