#include <bits/stdc++.h>
using namespace std;
bool a[1005];
int main() {
  int n, x, i, j;
  bool flag = false;
  while (scanf("%d,", &n) != EOF) a[n] = true;
  for (i = j = 1; i < 1001; i = ++j) {
    if (a[i]) {
      j = i;
      while (a[j]) j++;
      j--;
      if (flag)
        cout << ',';
      else
        flag = true;
      if (i == j)
        cout << i;
      else
        cout << i << '-' << j;
    }
  }
  return 0;
}
