#include #include int count(int n) { int i = 0; while(n/=10) i++; return i+1; } int main() { int N,A,B; int cnt,dim,i = 0; std::cin >> N; cnt = count(N); A = B = 0; while(cnt--) { if((dim = N % 10) == 7){ A += 6*pow(10,i); B += 1*pow(10,i); }else{ A += dim*pow(10,i); } N /= 10; i++; } std::cout << A << ' ' << B << std::endl; return 0; }