#include <bits/stdc++.h>
using namespace std;
template <class T>
T input(std::istream &is) {
  T value;
  is >> value;
  return value;
}
template <class Function>
void repeat(std::size_t n, Function f) {
  while (n--) f();
}
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  std::string line;
  getline(cin, line);
  replace(line.begin(), line.end(), ',', ' ');
  std::vector<bool> pages(1050);
  {
    std::istringstream iss(line);
    unsigned page;
    while (iss >> page) pages[page] = true;
  }
  auto first = find(pages.begin(), pages.end(), true);
  bool is_first = true;
  while (first != pages.end()) {
    const auto last = find(first, pages.end(), false);
    const auto left = first - pages.begin();
    const auto right = last - pages.begin() - 1;
    if (is_first) {
      is_first = false;
    } else {
      cout << ',';
    }
    if (left == right)
      cout << left;
    else
      cout << left << '-' << right;
    first = find(last, pages.end(), true);
  }
  cout << '\n';
}
