Last active
April 7, 2019 02:13
-
-
Save lapla-cogito/30747b637daf6318e967434028a66b6c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "bits/stdc++.h" | |
using namespace std; | |
int main() { | |
long long n; | |
cin >> n; | |
for (long long k = 1; k <= n; ++k) { | |
string h; | |
cin >> h; | |
bool mon = 0; | |
vector<char>a, b; | |
for (int i = 0; i < h.length(); ++i) { | |
if (h[i] != '0') { mon = 1; } | |
if (h[i] == '4') { | |
a.push_back('1'); | |
b.push_back('3'); | |
} | |
else { | |
a.push_back(h[i]); | |
if (mon) { b.push_back('0'); } | |
} | |
} | |
cout << "Case #" << k << ":" << " "; | |
bool ok = false; | |
for (auto i : a) { | |
if (ok&&i == '0') { cout << i; } | |
else if (i != '0') { cout << i; ok = 1; } | |
} | |
cout << " "; | |
ok = 0; | |
for (auto i : b) { | |
if (ok&&i == '0') { cout << i; } | |
else if (i != '0') { cout << i; ok = 1; } | |
} | |
cout << endl; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment