#include <bits/stdc++.h>
bool mark[2000];
using namespace std;
vector<int> numbers;
int toint(string s, int first, int end) {
  int ans = 0;
  for (int i = first; i < end; i++) {
    ans = ans * 10 + (s[i] - '0');
  }
  return ans;
}
int main() {
  string s;
  cin >> s;
  int index = 0;
  int num = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == ',' || i == s.size() - 1) {
      if (i == s.size() - 1)
        num = toint(s, index, i + 1);
      else
        num = toint(s, index, i);
      if (!mark[num]) {
        numbers.push_back(num);
        mark[num] = 1;
      }
      index = i + 1;
    }
  }
  sort(numbers.begin(), numbers.end());
  int ind[2] = {0, 0};
  int size_of_output = 0;
  bool f = false;
  for (int i = 1; i < numbers.size(); i++) {
    if (numbers[i] == numbers[i - 1] + 1) {
      ind[1]++;
      f = 1;
    } else {
      f = 0;
      if (ind[1] - ind[0] == 0) {
        if (size_of_output > 0) {
          cout << "," << numbers[ind[0]];
        } else
          cout << numbers[ind[0]];
      } else {
        if (size_of_output > 0) {
          cout << "," << numbers[ind[0]] << "-" << numbers[ind[1]];
        } else
          cout << numbers[ind[0]] << "-" << numbers[ind[1]];
      }
      ind[0] = ind[1] = i;
      size_of_output++;
    }
  }
  if (ind[1] - ind[0] == 0) {
    if (size_of_output > 0) {
      cout << "," << numbers[ind[0]];
    } else
      cout << numbers[ind[0]];
  } else {
    if (size_of_output > 0) {
      cout << "," << numbers[ind[0]] << "-" << numbers[ind[1]];
    } else
      cout << numbers[ind[0]] << "-" << numbers[ind[1]];
  }
  cout << endl;
}
