#include <bits/stdc++.h>
using namespace std;
int main() {
  bool mark[1005];
  memset(mark, false, sizeof(mark));
  char c;
  int n;
  while (scanf("%d%c", &n, &c)) {
    mark[n] = true;
    if (c == '\n') break;
  }
  vector<pair<int, int> > ans;
  int start = INT_MAX, end = -1;
  for (int i = 0; i < 1005; i++) {
    if (mark[i] == false) {
      if (end != -1) {
        ans.push_back(pair<int, int>(start, end));
      }
      start = INT_MAX;
      end = -1;
    } else {
      start = min(start, i);
      end = max(end, i);
    }
  }
  for (int i = 0; i < int(ans.size()); i++) {
    if (ans[i].first == ans[i].second) {
      cout << ans[i].first;
    } else {
      cout << ans[i].first << "-" << ans[i].second;
    }
    if (i < int(ans.size()) - 1) cout << ",";
  }
  cout << "" << endl;
  return 0;
}
