#include <bits/stdc++.h>
using namespace std;
int ptr;
int len;
string input;
void init() {
  ptr = 0;
  len = input.length();
}
int get_page_num() {
  int res = 0;
  while (ptr < len && input[ptr] != ',') {
    res = 10 * res + (input[ptr] - '0');
    ptr += 1;
  }
  ptr += 1;
  return res;
}
void solve() {
  vector<int> nums;
  for (int num; num = get_page_num();) {
    nums.push_back(num);
  }
  sort(nums.begin(), nums.end());
  int start = nums[0];
  int end = nums[0];
  for (int i = 1; i < nums.size(); i++) {
    if (end == nums[i]) continue;
    if (end + 1 == nums[i])
      end = nums[i];
    else {
      if (start == end)
        printf("%d,", start);
      else
        printf("%d-%d,", start, end);
      start = end = nums[i];
    }
  }
  if (start == end)
    printf("%d\n", start);
  else
    printf("%d-%d\n", start, end);
}
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(0);
  cin >> input;
  init();
  solve();
  return 0;
}
