#include <bits/stdc++.h>
using namespace std;
inline bool check(int* a, int len) {
  if (len == 1) return false;
  for (register int i = 2; i <= len; i++) {
    if (a[i] - a[i - 1] != 1) return false;
  }
  return true;
}
string ans;
int a[105];
int main() {
  set<int> st;
  int x;
  while (cin >> x) {
    st.insert(x);
    scanf(",");
  }
  set<int>::iterator it_end = st.end();
  for (register set<int>::iterator it = st.begin(); it != it_end;) {
    memset(a, 0, sizeof(a));
    set<int>::iterator it_tmp = it, new_it;
    bool flag = false;
    ++it_tmp;
    int cur = 1, begin = *it, end = 0;
    a[cur] = *it;
    for (register set<int>::iterator it_2 = it_tmp; it_2 != it_end; ++it_2) {
      a[++cur] = *it_2;
      if (check(a, cur)) {
        end = *it_2;
        new_it = it_2;
        flag = true;
      } else
        break;
    }
    if (flag) {
      ans += to_string(begin) + "-" + to_string(end) + ",";
    } else
      ans += to_string(*it) + ",";
    if (flag) {
      it = new_it;
      ++it;
    } else
      ++it;
  }
  ans.pop_back();
  cout << ans << endl;
  return 0;
}
