#include <bits/stdc++.h>
using namespace std;
int str_to_num(string str) {
  int num = 0;
  for (int i = 0; i < str.size(); i++) {
    num = num * 10 + (str[i] - 48);
  }
  return num;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string s, ans = "";
  cin >> s;
  vector<int> v;
  vector<pair<int, int> > vec;
  bool visited = false;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == ',') {
      v.push_back(str_to_num(ans));
      ans = "";
      continue;
    }
    ans += s[i];
  }
  v.push_back(str_to_num(ans));
  sort(v.begin(), v.end());
  int start = v[0], end = v[0];
  for (int i = 1; i < v.size(); i++) {
    if (v[i] - v[i - 1] > 1 && i != 0) {
      vec.push_back(make_pair(start, end));
      start = v[i];
    }
    if (i == v.size() - 1) vec.push_back(make_pair(start, v.back()));
    end = v[i];
  }
  for (int i = 0; i < vec.size(); i++) {
    if (vec[i].first != vec[i].second)
      cout << vec[i].first << "-" << vec[i].second;
    else
      cout << vec[i].first;
    if (i != vec.size() - 1) cout << ",";
  }
  if (v.size() == 1) cout << v.back();
  return 0;
}
