#include <bits/stdc++.h>
using namespace std;
string toStr(int n) {
  stringstream ss;
  ss << n;
  string tmp = ss.str();
  return tmp;
}
int main() {
  set<int> s;
  string str;
  cin >> str;
  int i = 0;
  string cur = "";
  while (i < str.size()) {
    if (str[i] == ',') {
      int tmp = atoi(cur.c_str());
      s.insert(tmp);
      cur = "";
      i++;
      continue;
    }
    cur += str[i];
    i++;
  }
  s.insert(atoi(cur.c_str()));
  vector<int> data;
  set<int>::iterator it;
  for (it = s.begin(); it != s.end(); it++) data.push_back((*it));
  i = 0;
  vector<string> ans;
  while (i < data.size()) {
    int j = i + 1;
    int tmp = -1;
    while (data[j] - data[j - 1] == 1) tmp = data[j++];
    string page;
    if (tmp == -1)
      page = toStr(data[i]);
    else {
      page = toStr(data[i]);
      page += '-';
      page += toStr(tmp);
    }
    ans.push_back(page);
    i = j;
  }
  for (int i = 0; i < ans.size(); i++)
    cout << ans[i] << ",\n"[i == ans.size() - 1];
  return 0;
}
