#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3fffffff;
const int N = 1005;
struct node {
  int l, r;
};
vector<node> ans;
bool used[N];
int main() {
  int i, j, k;
  int n;
  while (1) {
    cin >> n;
    used[n] = 1;
    if (getchar() == '\n') break;
  }
  i = 1;
  while (i <= 1000) {
    while (!used[i]) i++;
    if (i > 1000) break;
    j = i;
    while (used[j]) j++;
    node now;
    now.l = i, now.r = j - 1;
    i = j;
    ans.push_back(now);
  }
  int size = ans.size();
  for (i = 0; i < size; i++) {
    node now = ans[i];
    if (now.l == now.r)
      cout << now.l;
    else
      cout << now.l << "-" << now.r;
    if (i != size - 1) cout << ",";
  }
  cout << endl;
  return 0;
}
