#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, i, t = 0, g = 0, e = 1;
  int ar[100000] = {0};
  char c;
  while (1) {
    scanf("%d%c", &a, &c);
    ar[a] = 1;
    if (c != ',') break;
  }
  for (i = 0; i <= 100000; i++) {
    if (ar[i] != 0) {
      t += 1;
    } else if (t >= 2) {
      if (e == 0)
        cout << "," << i - t << "-" << i - 1;
      else {
        cout << i - t << "-" << i - 1;
        e = 0;
      }
      t = 0;
    } else if (t == 1) {
      if (e == 0)
        cout << "," << i - 1;
      else {
        cout << i - 1;
        e = 0;
      }
      t = 0;
    }
  }
  return 0;
}
