#include <bits/stdc++.h>
using namespace std;
int main() {
  static char s[100000];
  scanf("%s", s);
  int n = (int)strlen(s);
  vector<int> w;
  for (int i = 0; i < n;) {
    if (s[i] == ',') continue;
    int j;
    for (j = i + 1; j < n && s[j] != ','; ++j)
      ;
    int a;
    s[j] = 0;
    sscanf(s + i, "%d", &a);
    w.push_back(a);
    i = j + 1;
  }
  sort(w.begin(), w.end());
  w.resize(unique(w.begin(), w.end()) - w.begin());
  n = (int)w.size();
  for (int i = 0; i < n;) {
    int j;
    for (j = i + 1; j < n && w[j] - w[j - 1] <= 1; ++j)
      ;
    if (i) printf(",");
    if (j - i > 1)
      printf("%d-%d", w[i], w[j - 1]);
    else
      printf("%d", w[i]);
    i = j;
  }
  return 0;
}
