From f542500235a2d32508860f83cebc8b54fbf71a09 Mon Sep 17 00:00:00 2001 From: Milan Prajapati <83503297+milanprajapati571@users.noreply.github.com> Date: Sun, 23 Mar 2025 20:54:26 +0530 Subject: [PATCH] Create 1955C-InhabitantoftheDeepSea.cpp --- 1955C-InhabitantoftheDeepSea.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 1955C-InhabitantoftheDeepSea.cpp diff --git a/1955C-InhabitantoftheDeepSea.cpp b/1955C-InhabitantoftheDeepSea.cpp new file mode 100644 index 0000000..1a1f3fc --- /dev/null +++ b/1955C-InhabitantoftheDeepSea.cpp @@ -0,0 +1,24 @@ +#include +#define int long long +using namespace std; + + +void solve() { + string x, y; cin >> x >> y; + int n = x.size(); + bool flag = false; + for(int i = 0; i < n; ++i) { + if ((x[i] > y[i]) == flag) swap(x[i], y[i]); + flag |= (x[i] != y[i]); + } + cout << x << '\n' << y << '\n'; +} + +int32_t main() { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + cout.tie(NULL); + int t; cin >> t; + while(t--) solve(); + return 0; +}