S=input() a=['6' if c =='7' else c for c in S] b=['1' if c =='7' else '0' for c in S] print("".join(a),"".join(b))