#include <bits/stdc++.h>
using namespace std;
const int inf = 1999999999;
const double pi = acos(-1.0);
const double eps = 1e-10;
char gc() {
  char c;
  while (isspace(c = getchar()))
    ;
  return c;
}
int main() {
  char in[100000];
  scanf("%s", in);
  for (int i = 0; in[i]; i++)
    if (!isdigit(in[i])) in[i] = ' ';
  stringstream ss((string)in);
  vector<int> v;
  int t;
  while (ss >> t) v.push_back(t);
  sort((v).begin(), (v).end());
  v.erase(unique((v).begin(), (v).end()), v.end());
  int p = -inf;
  bool b = false, b2 = false;
  ;
  for (int i = 0; i < ((int)(v).size()); i++) {
    if (v[i] != p) {
      if (b) {
        putchar('-');
        printf("%d", p - 1);
        putchar(',');
      } else if (b2)
        putchar(',');
      printf("%d", v[i]);
      b2 = true;
      b = false;
    } else
      b = true;
    p = v[i] + 1;
  }
  if (b) {
    putchar('-');
    printf("%d", p - 1);
  }
}
