#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int nax = 1e6 + 10;
vector<int> tree(4 * nax);
long long i, j, x, y, k;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  string s, ans;
  cin >> s;
  vector<long long> a;
  for (i = 0; i < s.length();) {
    string a1;
    while (s[i] != ',' && i < s.length()) {
      a1 += s[i];
      i++;
    }
    i++;
    long long x;
    stringstream geek(a1);
    geek >> x;
    a.push_back(x);
  }
  sort(a.begin(), a.end());
  vector<long long>::iterator it;
  it = unique(a.begin(), a.begin() + a.size());
  a.resize(distance(a.begin(), it));
  for (i = 0; i < a.size();) {
    long long p = a[i];
    while (a[i + 1] == a[i] + 1 && i < a.size()) {
      i++;
    }
    long long q = a[i];
    ans += to_string(p);
    if (q != p) {
      ans += '-';
      ans += to_string(q);
    }
    if (i != a.size() - 1) ans += ',';
    i++;
  }
  cout << ans << endl;
}
