V = input()
INT = ''
STR = V
STR2 = ''
for i in V:
if i.isdigit():
INT += i
STR = STR.replace(i, '')
for i in STR:
if i.isupper():
STR2 += i
STR = STR.replace(STR2, '')
for i in STR:
if i.islower():
STR2 += i
STR = STR.replace(STR2, '')
print(INT)
print(STR2)