#include <bits/stdc++.h>
using namespace std;
set<int> st;
int main() {
  char c;
  int co = 0, n;
  int vis[1005], a[1005];
  memset(vis, 0, sizeof vis);
  while (scanf("%d%*c", &n) != EOF) {
    vis[n] = 1;
  }
  for (int i = 1, j = 1; i <= 1001; i = ++j) {
    if (vis[i]) {
      for (j = i; vis[j]; j++)
        ;
      j--;
      if (!co)
        co = 1;
      else
        cout << ",";
      if (i == j)
        cout << i;
      else
        cout << i << "-" << j;
    }
  }
}
