N=input() O=list(N) P=int(''.join(['01'[O[i]=='7'] for i in range(len(N))])) print(int(N)-P,P)