|
<p> |
|
Every business can make use of a good accountant and, if they're not big on following the law, |
|
sometimes a bad one. |
|
Bad accountants try to make more money for their employers by fudging numbers |
|
without getting caught. |
|
</p> |
|
|
|
<p> |
|
Sometimes a bad accountant wants to make a number larger, and sometimes smaller. |
|
It is widely known that tax auditors will fail to notice two digits being swapped in any given number, |
|
but any discrepancy more egregious will certainly be caught. It's also painfully obvious when a |
|
number has fewer digits than it ought to, so a bad accountant will never swap the first digit of a number |
|
with a 0. |
|
</p> |
|
|
|
<p> |
|
Given a number, how small or large can it be made without being found out? |
|
</p> |
|
|
|
|
|
<h3>Input</h3> |
|
|
|
<p> |
|
Input begins with an integer <strong>T</strong>, the number of numbers |
|
that need tweaking. Each of the next <strong>T</strong> lines contains a |
|
integer <strong>N</strong>. |
|
</p> |
|
|
|
|
|
|
|
<h3>Output</h3> |
|
|
|
<p> |
|
For the <em>i</em>th number, print a line containing "Case #<em>i</em>: " followed by the smallest and largest |
|
numbers that can be made from the original number <strong>N</strong>, using at most a single swap and following the |
|
rules above. |
|
</p> |
|
|
|
<h3>Constraints</h3> |
|
|
|
<p> |
|
1 ≤ <strong>T</strong> ≤ 100 <br /> |
|
0 ≤ <strong>N</strong> ≤ 999999999 <br /> |
|
<strong>N</strong> will never begin with a leading 0 unless <strong>N</strong> = 0<br /> |
|
</p> |
|
|