You are given string s. Let's call word any largest sequence of consecutive symbols without symbols ',' (comma) and ';' (semicolon). For example, there are four words in string "aba,123;1a;0": "aba", "123", "1a", "0". A word can be empty: for example, the string s=";;" contains three empty words separated by ';'.

You should find all words in the given string that are nonnegative INTEGER numbers without leading zeroes and build by them new string a. String a should contain all words that are numbers separating them by ',' (the order of numbers should remain the same as in the string s). By all other words you should build string b in the same way (the order of numbers should remain the same as in the string s).

Here strings "101", "0" are INTEGER numbers, but "01" and "1.0" are not.

For example, for the string aba,123;1a;0 the string a would be equal to "123,0" and string b would be equal to "aba,1a".


-----Input-----

The only line of input contains the string s (1 ≤ |s| ≤ 10^5). The string contains only symbols '.' (ASCII 46), ',' (ASCII 44), ';' (ASCII 59), digits, lowercase and uppercase latin letters.


-----Output-----

Print the string a to the first line and string b to the second line. Each string should be surrounded by quotes (ASCII 34).

If there are no words that are numbers print dash (ASCII 45) on the first line. If all words are numbers print dash on the second line.


-----Examples-----
Input
aba,123;1a;0

Output
"123,0"
"aba,1a"

Input
1;;01,a0,

Output
"1"
",01,a0,"

Input
1

Output
"1"
-

Input
a

Output
-
"a"



-----Note-----

In the second example the string s contains five words: "1", "", "01", "a0", "".

Difficulty: interview

Starter code:

Solutions:
#!/usr/bin/env python3

import re

try:
    while True:
        a = [ ]
        b = [ ]
        for word in re.split(R"[,;]", input()):
            (a if re.match(R"^(0|[1-9][0-9]*)$", word) else b).append(word)
        print('"%s"' % ','.join(a) if a else '-')
        print('"%s"' % ','.join(b) if b else '-')

except EOFError:
    pass


s = input().replace(';', ',').split(',')
a, b = [], []
for i in s:
    if i.isdigit() and str(int(i)) == i:
        a.append(i)
    else:
        b.append(i)

if a:
    print('"{}"'.format(','.join(a)))
else:
    print('-')

if b:
    print('"{}"'.format(','.join(b)))
else:
    print('-')


def isNumber(x):
    try:
        p = int(x)
        return x == str(p)
    except:
        return False

def conc(p):
    if len(p) == 0:
        return "-"

    s = "\""
    for i in range(len(p)-1):
        s += p[i] + ','
    s += p[len(p)-1] + "\""

    return s

s = input().split(";")
p = []
q = []

for l in s:
    for i in l.split(","):
        if isNumber(i):
            p.append(i)
        else:
            q.append(i)

p = conc(p)
q = conc(q)

print(p)
print(q)


import re

s = input()
s = re.split(',|;', s)
a = []
b = []
for i in s:
    try:
        if str(int(i)) == i:
            a.append(i)
        else:
            b.append(i)
    except ValueError:
        b.append(i)
if len(a) == 0:
    print('-')
else:
    print("\"{}".format(a[0]), end='')
    for i in a[1:]:
        print(',{}'.format(i), end='')
    print('"')
if len(b) == 0:
    print('-')
else:
    print("\"{}".format(b[0]), end='')
    for i in b[1:]:
        print(',{}'.format(i), end='')
    print('"')

s = input()
a = []
b = []
tmp = ""
for i in s:
	if i == ',' or i == ';':
		if len(tmp) > 0 and tmp.isdigit() and (len(tmp) == 1 or tmp[0] != '0'):
			a.append(tmp)
		else:
			b.append(tmp)
		tmp = ''
	else:
		tmp = tmp + i
if len(tmp) > 0 and tmp.isdigit() and (len(tmp) == 1 or tmp[0] != '0'):
	a.append(tmp)
else:
	b.append(tmp)
if len(a) > 0:
	print("\"" + ','.join(a) + "\"")
else:
	print('-')
if len(b) > 0:
	print("\"" + ','.join(b) + "\"")
else:
	print('-')

s = input().split(',')
a = '"'
b = '"'
for t in s:
    for word in t.split(';'):
        if word.isdigit() and (word[0]!='0' or word=="0"):
            a = a+word+','
        else:
            b = b+word+','
if len(a)==1:
    print('-')
else:
    print(a[0:len(a)-1]+'"')
if len(b)==1:
    print('-')
else:
    print(b[0:len(b)-1]+'"')

import re

ss = re.split(";|,", input())
a = []
b = []

p = re.compile('^(-?([1-9]\d*)|0)$')

for s in ss:
    if p.match(s):
        a.append(s)
    else:
        b.append(s)

print('"' + ','.join(a) + '"' if len(a) else '-')
print('"' + ','.join(b) + '"' if len(b) else '-')



import sys
#sys.stdin=open("data.txt")
input=sys.stdin.readline

number=[]
word=[]

temp=[]
period=0
bad=0
for i in input().strip()+",":
    if i in ",;":
        if period or bad:
            word.append("".join(temp))
        elif len(temp)==0:
            word.append("")
        elif temp[0]=="0":
            if len(temp)==1 or temp[1]==".":
                number.append("".join(temp))
            else:
                word.append("".join(temp))
        else:
            number.append("".join(temp))
        temp=[]
        period=0
        bad=0
    else:
        if i==".":
            period+=1
        elif i not in ".0123456789":
            bad+=1
        temp.append(i)

if len(number): print('"%s"'%(",".join(number)))
else: print("-")
if len(word): print('"%s"'%(",".join(word)))
else: print("-")



a = list(map(str, input().replace(';', ',').split(',')))
#print(a)
c = []
d = []
for i in a:
    try:
        if str(int(i)) == i:
            c += [i]
        else:
            d += [i]
    except:
        d += [i]
if len(c) == 0:
    print("-")
else:
    ans = ""
    for i in c:
        ans += i + ','
    print('"' + ans[:-1] + '"')
if len(d) == 0:
    print("-")
else:
    ans = ""
    for i in d:
        ans += i + ','
    print('"' + ans[:-1] + '"')
    
    


import math
from decimal import *
import sys
from fractions import Fraction


s=input()
l=len(s)
s2=""
for i in range(0,l):
   if s[i]==';' or s[i]==',':
      s2+="# #"
   else:
      s2+=s[i]
sl=s2.split()
l=len(sl)

N="0123456789"
a=[]
b=[]
for i in range(0,l):
   w=sl[i]
   l2 = len(w)
   num=1
   if l2 != 0:
      if w[l2-1] == "#":
         w = w[:-1]
         l2=len(w)

   if l2 != 0:
      if w[0] == "#":
         w = w[1:]
         l2=len(w) 
   if l2==0:
      num=0
   for k in range(0,l2):
      if w[0] == '0' and l2>1:
         num=0
      if w[k] not in N:
         num=0
   if num==1:
      a.append(w)
   else:
      b.append(w)
la=len(a)
lb=len(b)

sa="\""
sb="\""
if la==0:
   sa="-"
else:
   for i in range(0,la-1):
      sa += a[i]+","
   sa += a[la-1]+"\""
print(sa)

if lb==0:
   sb="-"
else:
   for i in range(0,lb-1):
      sb += b[i]+","
   sb += b[lb-1]+"\""
print(sb)
      



def is_num(s):
    if len(s) == 0:
        return False
    if s[0] == '0' and len(s) > 1:
        return False
    for i in s:
        c = str(i)
        if not c.isdigit():
            return False
    return True
a = list(input().split(sep=","))
b = []
for i in a:
    t = list(i.split(sep=";"))
    for j in t:
        b.append(j)
ans = []
ans2 = []
for i in range(len(b)):
    if is_num(b[i]):
        ans.append(b[i])
        b[i] = "*"
    else:
        ans2.append(b[i])
if len(ans) == 0:
    print("-")
else:
    print("\"", end="")
    print(*ans, sep=",", end="")
    print("\"")
if len(ans2) == 0:
    print("-")
else:
    print("\"", end="")
    print(*ans2, sep=",", end="")
    print("\"")


s = input()
a = s.replace(';', ',').split(',')
c, d = [], []

for elem in a:
    if elem.isdigit() and (elem[0] != '0' or len(elem) == 1):
        c.append(elem)
    else:
        d.append(elem)
if (len(c) == 0):
    print('-')
    #print('"' + ','.join(c) + '"')
    print('"' + ','.join(d) + '"')    
elif (len(d) == 0):
    print('"' + ','.join(c) + '"')
    #print('"' + ','.join(d) + '"')    
    print('-')
else:
    print('"' + ','.join(c) + '"')
    print('"' + ','.join(d) + '"')    

s = input()
t = ''
b = ''
a = ''
for i in range(len(s)):
    if not s[i] in [';', ',']:
        t += s[i]
    else:
        if t.isdigit() and not (len(t) > 1 and t[0] == '0'):
            a += t + ','
        else:
            b += t + ','
        t = ''

if t.isdigit() and not (len(t) > 1 and t[0] == '0'):
    a += t + ','
else:
    b += t + ','
if not len(a) == 0:
    print('\"' + a[:-1] + '\"')
else:
    print('-')
if not len(b) == 0:
    print('\"' + b[:-1] + '\"')
else:
    print('-')

b=[]
def check(x):
    if '.' in x:
        return False
    if x == '0':
        return True
    if x == '':
        return False
    if x[0] == '0':
        return False
    for i in x:
        if i not in '1234567890':
            return False
    return True
s = input()
k=''
for i in s:
    if i == ';':
        k+=','
    else:
        k+=i

kk = k.split(',')
a = []
for i in kk:
    if check(i):
        a.append(i)
    else:
        b.append(i)

if a == []:
    print("-")
else:
    print('"' + ','.join(a) + '"')

if b == []:
    print("-")
else:
    print('"' + ','.join(b)+'"')


def main():
  ss = input().split(';')
  s = []
  for word in ss:
    s.extend(word.split(','))

  a = []
  b = []

  for word in s:
    if word.isdecimal() and ( len(word) > 1 and word[0] != '0' or len(word) == 1):
      a.append(word)
    else:
      b.append(word)

  print('"' + ','.join(a) + '"' if len(a) else '-')
  print('"' + ','.join(b) + '"' if len(b) else '-')



#help(str)
main()

s = input()
s = s.replace(",", ";")
s = s.split(";")
ans1, ans2 = [], []
for elem in s:
    if len(elem) > 0:
        if elem == "0" or elem[0] != "0":
            try:
                x = int(elem)
                ans1.append(x)
            except:
                ans2.append(elem)
        else:
            ans2 += [elem]
    else:
        ans2 += [""]
if ans1:
    print('"', end="")
    print(*ans1, sep=",", end='"\n')
else:
    print("-")

if ans2:
    print('"', end="")
    print(*ans2, sep=",", end='"\n')
else:
    print("-")

l = input()
l = l.replace(";", ",")
l = l.split(",")
nums = []
alpha = []

for i in l:
    try:
        num = int(i)
        if str(num) == i:
            nums.append(str(num))
        else:
            alpha.append(i)
    except:
        alpha.append(i)

if len(nums) == 0:
    print("-")
else:
    print("\""+",".join(nums)+"\"")
if len(alpha) == 0:
    print("-")
else:
    print("\""+",".join(alpha)+"\"")



import sys
#sys.stdin=open("data.txt")
input=sys.stdin.readline

number=[]
word=[]

temp=[]
bad=0
for i in input().strip()+",":
    if i in ",;":
        if bad:
            word.append("".join(temp))
        elif len(temp)==0:
            word.append("")
        elif temp[0]=="0":
            if len(temp)==1:
                number.append("".join(temp))
            else:
                word.append("".join(temp))
        else:
            number.append("".join(temp))
        temp=[]
        bad=0
    else:
        if i not in "0123456789":
            bad+=1
        temp.append(i)

if len(number): print('"%s"'%(",".join(number)))
else: print("-")
if len(word): print('"%s"'%(",".join(word)))
else: print("-")



s=input()
s1=len(s)
i=0
a,b=[],[]
while(i<s1):
    j=i
    k=""
    while(j<s1 and s[j]!=';' and s[j]!=','):
        k+=s[j]
        j+=1
    k1=len(k)
    if(k1==0):
        b.append(k)
    elif(k1>1 and (k[0]=='-' or k[0]=='0')):
        b.append(k)
    else:
        fl=1
        for m in range(k1):
            k2=ord(k[m])
            if(k2>=48 and k2<=57):
                continue
            else:
                fl=0
                break
        if(fl):
            a.append(k)
        else:
            b.append(k)
    i=j+1
if(s[-1]==';' or s[-1]==','):
    b.append("")
a1=len(a)
b1=len(b)
if(a1>0):
    print('\"',end="")
    for i in range(a1):
        print(a[i],end="")
        if(i!=a1-1):
            print(',',end="")
    print('\"')
else:
    print('-')
if(b1>0):
    print('\"',end="")
    for i in range(b1):
        print(b[i],end="")
        if(i!=b1-1):
            print(',',end="")
    print('\"')
else:
    print('-')


from math import ceil, modf
s = input().replace(",", ";")
s = s.split(";")
a = []
b = []
for i in s:
    try:
        d = str(int(i))
        if len(i)>1 and i[0] == "0" or i[0] == "-":
            b.append(i)
        else:
            a.append(d)
    except ValueError:
        b.append(i)
if a:
    print('"'+",".join(a)+'"')
else:
    print("-")
if b:
    print('"'+",".join(b)+'"')
else:
    print("-")


inp = input()

inp = inp.replace(',', ';')
tokens = inp.split(';')
# print(tokens);

a = []
b = []
for token in tokens:
    if (token.isdigit() and token[0] != '0') or token == '0':
        a.append(token)
    else:
        b.append(token)

if len(a) is 0:
    print('-')
else:
    print("\"" + ','.join(a) + "\"")

if len(b) is 0:
    print('-')
else:
    print("\"" + ','.join(b) + "\"")


s = input()
a = []
b = []
last_word = []
temp = 0
digits = "0123456789"
for letter in s:
    if letter == ";" or letter == ",":
        for leter in last_word:
            if digits.find(leter) == -1:
                temp = 1
                break
        if temp == 0 and len(last_word) != 0:
            if last_word[0] != "0" or len(last_word) == 1:
                a += ("".join(last_word)).split()
            else:
                b += ("".join(last_word)).split()
        elif len(last_word) == 0:
            temp = 0
            b += [""]
        else:
            temp = 0
            b += ("".join(last_word)).split()
        last_word = []
    else:
        last_word += letter
for leter in last_word:
        if digits.find(leter) == -1:
            temp = 1
            break
if temp == 0 and len(last_word) != 0:
    if last_word[0] != "0" or len(last_word) == 1:
        a += ("".join(last_word)).split()
    else:
        b += ("".join(last_word)).split()
elif len(last_word) == 0:
    temp = 0
    b += [""]
else:
    temp = 0
    b += ("".join(last_word)).split()
    
if len(a) == 0:
    print("-")
else:
    print('"',end="")
    print(",".join(a),end="")
    print('"')
    
if len(b) == 0:
    print("-")
else:
    print('"',end="")
    print(",".join(b),end="")
    print('"')


str = input().replace(';', ',')
lst = str.split(',')


a = ''
b = ''
first_in_a = True
first_in_b = True
amount = 0

for item in lst:
    is_int = True
    for ch in item:
        if not (48 <= ord(ch) <= 57):
            is_int = False
            break
    if len(item) == 0:
        is_int = False
    if is_int:
        if (len(item) > 1) and (item[0] == '0'):
            is_int = False
    if is_int:
        if not first_in_a:
            a += ','
        else:
            first_in_a = False
        a += item
    else:
        if not first_in_b:
            b += ','
        else:
            first_in_b = False
        b += item
        amount += 1

if len(a) > 0:
    print('"%s"' % a)
else:
    print('-')
if amount > 0:
    print('"%s"' % b)
else:
    print('-')

a, b = [], []
for w in input().replace(';', ',').split(','):
    if str.isdigit(w) and (len(w) == 1 or w[0] != '0'):
        a.append(w)
    else:
        b.append(w)
for l in a, b:
    print('"' + ','.join(l) + '"' if l else '-')

l = input().replace(';',',').split(',')
res1 = []
res2 = []

def isValid(a):
	if a.startswith("0") and a != "0":
		return False
	else:
		return a.isnumeric()



for i in range(0,len(l)):
	if isValid(l[i]):
		res1.append(l[i])
	else:
		res2.append(l[i])


if len(res1) == 0:
	print("-")
else:
	print("\""+",".join(res1)+"\"")

if len(res2) == 0:
	print("-")
else:
	print("\""+",".join(res2)+"\"")