#include <bits/stdc++.h>
using namespace std;
int ara[2000], cnt = 0;
int a, k = 0;
char c;
int main() {
  while (c != '\n') {
    cin >> a;
    c = getchar();
    ara[a] = 1;
  }
  while (k <= 1000) {
    if (ara[k] != 0) {
      if (cnt)
        cout << ',';
      else
        cnt = 1;
      cout << k;
      int ans = k;
      while (ara[k + 1] != 0) k++;
      if (k != ans) cout << '-' << k;
    }
    k++;
  }
  return 0;
}
