#include <bits/stdc++.h>
using namespace std;
const int NN = 1005;
int a[NN] = {0};
string s;
void T() {
  srand(time(NULL));
  ofstream fo("pagenumber.i4");
  fo.close();
}
int main() {
  ios_base::sync_with_stdio(0);
  getline(cin, s);
  int n = s.size(), pos, i, j, k, maxk = 0;
  string x;
  stringstream ss;
  i = j = 0;
  while (j != string::npos) {
    j = s.find_first_of(',', i);
    if (j == string::npos)
      x = s.substr(i);
    else
      x = s.substr(i, j - i);
    k = atoi(x.c_str());
    maxk = max(maxk, k);
    if (!a[k]) a[k] = 1;
    i = j + 1;
  }
  for (int i = 0; i <= maxk; i++)
    if (a[i]) {
      int left = i;
      while (a[i]) i++;
      i--;
      int right = i;
      cout << left;
      if (right - left > 0) cout << '-' << right;
      if (i < maxk) cout << ",";
    }
  return 0;
}
