#include #include #include using namespace std; int main(){ string n; cin >> n; vector a, b; for(int i = 0; i < n.size(); i++){ if(n[i]-'0' != 7){ a.emplace_back(n[i]-'0'); b.emplace_back(0); }else{ a.emplace_back(6); b.emplace_back(1); } } int aa = 0, bb = 0; for(auto &it: a) aa = aa*10+it; for(auto &it: b) bb = bb*10+it; cout << aa << " " << bb << endl; return 0; }