#include <bits/stdc++.h>
using namespace std;
bool a[1000] = {0};
vector<int> v;
int main() {
  int d;
  int dp[1001] = {};
  while (scanf("%d,", &d) == 1) {
    if (dp[d] != 1) {
      dp[d] = 1;
      v.push_back(d);
    }
  }
  int f = 0;
  for (int i = 1; i <= 1000; i++) {
    while (dp[i] == 0 && i <= 1000) {
      i++;
    }
    if (i > 1000) {
      break;
    }
    if (i < 1000 && f == 1) {
      cout << ",";
    }
    int st = i;
    int cnt = -1;
    while (dp[i] >= 1 && i <= 1000) {
      f = 1;
      i++;
      cnt++;
    }
    cout << st;
    if (cnt > 0) {
      cout << "-" << st + cnt;
    }
  }
}
