#include <bits/stdc++.h>
using namespace std;
using ll = long long;
vector<int> fun(string s) {
  vector<int> a;
  string t;
  int x = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] != ',') {
      t += s[i];
    } else {
      int size = t.size();
      int u = pow(10, size - 1);
      for (int j = 0; j < size; j++) {
        x += (t[j] - '0') * u;
        u /= 10;
      }
      a.push_back(x);
      t.clear();
      x = 0;
    }
  }
  int u = pow(10, t.size() - 1);
  for (int j = 0; j < t.size(); j++) {
    x += (t[j] - '0') * u;
    u /= 10;
  }
  a.push_back(x);
  return a;
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin >> s;
  vector<int> ar = fun(s);
  vector<bool> a(1001, false);
  int x = 1001, y = 0;
  int u = 0, v = 0, c = 0;
  for (int i = 0; i < ar.size(); i++) {
    {
      a[ar[i]] = true;
      x = min(x, ar[i]);
      y = max(y, ar[i]);
    }
  }
  for (int i = x; i <= y; i++) {
    if (a[i] && c == 0) {
      u = i;
      c++;
    } else if (a[i]) {
      v = i;
    }
    if (!a[i] && u > 0 && v > 0) {
      cout << u << '-' << v << ',';
      c = 0;
      u = 0;
      v = 0;
    } else if (!a[i] && u > 0 && v == 0) {
      cout << u << ',';
      u = 0;
      c = 0;
    }
  }
  if (u > 0 && v > 0) {
    cout << u << '-' << v << endl;
  } else if (u > 0 && v == 0) {
    cout << u << endl;
  }
}
