#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 1, -1, 0};
int dy[] = {1, 0, 0, -1};
long double PI = 3.14159265358979323846264338327950;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  cin >> s;
  int a[1005];
  memset(a, 0, sizeof a);
  for (int i = 0; i < (int)s.size(); i++) {
    string tmp;
    int num;
    while (s[i] != ',' && i < (int)s.size()) {
      tmp += s[i];
      i++;
    }
    stringstream ss;
    ss << tmp;
    ss >> num;
    ss.clear();
    a[num]++;
  }
  bool f = 0;
  for (int i = 0; i < 1005; i++) {
    if (a[i] && a[i + 1]) {
      if (f) cout << ',';
      f = 1;
      cout << i << "-";
      while (a[i] && a[i + 1] && i < 1005) {
        i++;
      }
      cout << i;
    } else if (a[i]) {
      if (f) cout << ',';
      f = 1;
      cout << i;
    }
  }
  return 0;
}
