#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, a, b, ta, t, tb;
  bool flag1, flag2, flag0;
  int l1, i, x;
  while (cin >> s) {
    l1 = s.size();
    flag1 = flag2 = flag0 = 0;
    for (i = 0; i < l1; i++) {
      if (s[i] == ',' || s[i] == ';') {
        if ((flag2 == 0 || flag2 == 1) && flag1 == 0) {
          b += ",";
          if (tb.size() == 0) {
            tb = b;
          } else {
            tb += b;
          }
          b.clear();
          flag2 = flag0 = 0;
          continue;
        } else if (flag1 == 1 && flag2 == 0) {
          a += ",";
          if (ta.size() == 0) {
            ta = a;
          } else {
            ta += a;
          }
          a.clear();
          flag1 = 0;
          continue;
        }
      }
      if (s[i] >= '0' && s[i] <= '9' && flag0 == 0 && flag2 == 0) {
        if (a.size() == 0) {
          a = " ";
          a[0] = s[i];
          flag1 = 1;
        } else if (a[0] == '0') {
          t = " ";
          t[0] = s[i];
          a += t;
          b += a;
          a.clear();
          flag0 = 1;
          flag1 = 0;
        } else {
          t = " ";
          t[0] = s[i];
          a += t;
          flag1 = 1;
        }
      } else {
        if (s[i - 1] >= '0' && s[i - 1] <= '9' && flag1 == 1) {
          b += a;
          a.clear();
          flag1 = 0;
        }
        t = " ";
        t[0] = s[i];
        b += t;
        flag2 = 1;
      }
    }
    if (a.size() != 0) {
      if (ta.size() == 0)
        ta = a;
      else
        ta += a;
    } else if (b.size() != 0) {
      if (tb.size() == 0)
        tb = b;
      else
        tb += b;
    }
    if (ta.size() == 0)
      printf("-\n");
    else {
      x = ta.size() - 1;
      if (ta[x] == ',') ta.erase(ta.begin() + x);
      cout << "\"" << ta << "\"\n";
    }
    if (tb.size() == 0) {
      if (s[l1 - 1] == ',' || s[l1 - 1] == ';')
        printf("\"\"\n");
      else
        printf("-\n");
    } else {
      x = tb.size() - 1;
      if (tb[x] == ',' && (s[l1 - 1] != ',' && s[l1 - 1] != ';'))
        tb.erase(tb.begin() + x);
      cout << "\"" << tb << "\"\n";
    }
    ta.clear();
    tb.clear();
    a.clear();
    b.clear();
    t.clear();
  }
  return 0;
}
