#include <bits/stdc++.h>
using namespace std;
const int OO = (int)2e9;
const double eps = 1e-9;
int daysInMonths[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int di[] = {-1, 0, 1, 0};
int dj[] = {0, 1, 0, -1};
int arr[1002], maxi = -1;
void Gen(string s) {
  int res = 0;
  for (int i = (0); i < ((int)s.size()); i++) {
    if (s[i] != ',') {
      res *= 10;
      res += (s[i] - '0');
    } else if (s[i] == ',') {
      arr[res]++;
      if (res > maxi) maxi = res;
      res = 0;
    }
  }
  arr[res]++;
  if (res > maxi) maxi = res;
}
int main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string s;
  cin >> s;
  Gen(s);
  for (int i = (1); i < (1001); i++) {
    if (arr[i] != 0) {
      int last_non_zero = i, j;
      for (j = i;; j++) {
        if (arr[j] != 0)
          last_non_zero = j;
        else
          break;
      }
      if (i == last_non_zero)
        cout << last_non_zero;
      else
        cout << i << "-" << last_non_zero;
      if (maxi != last_non_zero) cout << ",";
      i = last_non_zero;
    }
  }
  return 0;
}
