#include //#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include //using namespace atcoder; using namespace std; using ll = long long; #define all(A) A.begin(),A.end() using vll = vector; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) using Graph = vector>>; int main() { string S; cin >> S; rep(i, S.size()) { if (S[i] == '7')cout << 1; else cout << '0'; } cout << " "; rep(i, S.size()) { if (S[i] == '7')cout <<6; else cout << S[i]; } }