#include <bits/stdc++.h>
using namespace std;
const int MaxN = 1001;
bool h[MaxN + 5];
int main() {
  string S;
  cin >> S;
  S += ',';
  int L = S.length();
  int cur = 0;
  memset(h, 0, sizeof(h));
  for (int i = 0; i < L; i++) {
    if (S[i] == ',') {
      if (h[cur]) {
        cur = 0;
        continue;
      }
      h[cur] = 1;
      cur = 0;
    } else
      cur = cur * 10 + S[i] - '0';
  }
  L = 0;
  int R = 0;
  bool first = 0;
  for (int i = 1; i <= MaxN + 1; i++) {
    if (!h[i]) {
      if (L != 0 && R != 0) {
        if (first) printf(",");
        if (L == R) {
          printf("%d", L);
        } else
          printf("%d-%d", L, R);
        first = 1;
        L = R = 0;
      }
    } else {
      if (L == 0) L = i;
      R = i;
    }
  }
  return 0;
}
