N = input()

a = 0
b = 0
for c in N:
    a *= 10
    b *= 10
    if c == '7':
        a += 1
        b += 6
    else:
        a += int(c)
print(a, b)