#include <bits/stdc++.h>
using namespace std;
set<int> pages;
int string_to_int(string s) {
  int ans = 0;
  for (int i = 0; i < s.size(); i++) ans = ans * 10 + s[i] - '0';
  return ans;
}
void parse_input(string s) {
  int n = s.size();
  int i = 0;
  string curr = "";
  while (i < n) {
    if (s[i] == ',') {
      pages.insert(string_to_int(curr));
      curr = "";
    } else
      curr += s[i];
    i++;
  }
  pages.insert(string_to_int(curr));
}
int main() {
  string inp;
  cin >> inp;
  parse_input(inp);
  set<int>::iterator itr;
  itr = pages.begin();
  string ans = "";
  int lft = *itr, rght = *itr;
  itr++;
  for (; itr != pages.end(); itr++) {
    int cpage = (*itr);
    if (cpage == rght + 1)
      rght = cpage;
    else {
      if (lft == rght)
        ans = ans + to_string(lft) + ',';
      else
        ans = ans + to_string(lft) + '-' + to_string(rght) + ',';
      lft = rght = cpage;
    }
  }
  if (lft == rght)
    ans = ans + to_string(lft);
  else
    ans = ans + to_string(lft) + '-' + to_string(rght);
  cout << ans;
  return 0;
}
