#include <bits/stdc++.h>
using ul = std::uint32_t;
using li = std::int32_t;
using ull = std::uint64_t;
using ll = std::int64_t;
std::vector<ul> v;
std::string s;
int main() {
  std::getline(std::cin, s);
  std::stringstream ss(s);
  while (std::getline(ss, s, ',')) {
    std::stringstream ss(s);
    ul t;
    ss >> t;
    v.push_back(t);
  }
  std::sort(v.begin(), v.end());
  bool flag = false;
  for (ul i = 0, j = 0; i != v.size(); i = j) {
    for (++j; j != v.size() && v[j - 1] + 1 >= v[j]; ++j)
      ;
    if (flag) {
      std::putchar(',');
    }
    flag = true;
    if (v[j - 1] == v[i]) {
      std::printf("%u", v[i]);
    } else {
      std::printf("%u-%u", v[i], v[j - 1]);
    }
  }
  std::putchar('\n');
  return 0;
}
