#include <bits/stdc++.h>
using namespace std;
const int maxn = 1005;
int use[maxn];
int s, t, cs = 0;
char str[maxn];
void output() {
  if (s == -1) return;
  if (cs)
    printf(",");
  else
    cs = 1;
  if (s == t)
    printf("%d", s);
  else
    printf("%d-%d", s, t);
  s = -1;
}
int main() {
  scanf("%s", str);
  int len = strlen(str);
  for (int i = 0; i < len; ++i) {
    int num = 0;
    while (i < len && str[i] != ',') {
      num = num * 10 + str[i] - '0';
      ++i;
    }
    use[num] = 1;
  }
  s = -1;
  for (int i = 1; i <= 1001; ++i) {
    if (!use[i])
      output();
    else if (s == -1)
      s = t = i;
    else
      t++;
  }
  puts("");
  return 0;
}
