#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long i, j;
  vector<long long> v, v1, v2;
  string s, s2, s3;
  set<long long> st;
  cin >> s;
  long long n, m, x, z, cnt, ans, mx, t;
  for (i = 0; i < s.size(); i++) {
    if (s[i] == ',') {
      x = stoi(s2);
      st.insert(x);
      s2.clear();
    } else
      s2 += s[i];
  }
  if (!s2.empty()) {
    x = stoi(s2);
    st.insert(x);
    s2.clear();
  }
  for (auto i : st) v.push_back(i);
  z = 0;
  for (long long i = 0; i < v.size(); i++) {
    if (v[i] + 1 == v[i + 1] and z == 0) {
      x = v[i];
      z = 1;
    }
    if (v[i] + 1 != v[i + 1] and z == 0) {
      cout << v[i];
      if (i != v.size() - 1) cout << ",";
    }
    if (v[i] + 1 != v[i + 1] and z == 1) {
      cout << x;
      cout << "-";
      cout << v[i];
      if (i != v.size() - 1) cout << ",";
      z = 0;
    }
  }
  return 0;
}
