#include <bits/stdc++.h>
using namespace std;
const int BIG = 1e5 + 9;
const int INF = 1e9 + 9;
const long long BINF = 1e18 + 9;
const double SML = (1e-7);
string s, num;
vector<int> v;
vector<vector<int> > ans;
bool check[1009];
int power(int x, int n) {
  if (n == 0) {
    return 1;
  }
  int sq = power(x, n / 2);
  sq = sq * sq;
  if (n % 2 != 0) {
    sq = sq * x;
  }
  return sq;
}
int string_to_int(string& s) {
  int ans = 0;
  for (int i = s.size() - 1, j = 0; i >= 0; i--, j++) {
    ans = ans + (s[i] - '0') * power(10, j);
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] != ',') {
      num.push_back(s[i]);
    } else {
      if (!check[string_to_int(num)]) {
        check[string_to_int(num)] = true;
        v.push_back(string_to_int(num));
      }
      num = "";
    }
  }
  if (!check[string_to_int(num)]) {
    v.push_back(string_to_int(num));
  }
  sort(v.begin(), v.end());
  ans.push_back(vector<int>());
  for (int i = 0; i < v.size(); i++) {
    if (ans.back().empty()) {
      ans.back().push_back(v[i]);
    } else if (v[i] == ans.back().back() + 1) {
      ans.back().push_back(v[i]);
    } else {
      ans.push_back(vector<int>());
      ans.back().push_back(v[i]);
    }
  }
  for (int i = 0; i < ans.size(); i++) {
    if (ans[i].size() == 1) {
      cout << ans[i].back();
    } else {
      cout << ans[i].front() << '-' << ans[i].back();
    }
    if (i != ans.size() - 1) {
      cout << ',';
    }
  }
  return 0;
}
