atcoder#ARC130C. [ARC130C] Digit Sum Minimization
[ARC130C] Digit Sum Minimization
Score : points
Problem Statement
Given are positive integers , where none of the digits is .
Permute the digits of each of and so that the sum of the digits in is minimized.
Constraints
- None of the digits of and is .
Input
Input is given from Standard Input in the following format:
Output
After permuting the digits of each of and so that the sum of the digits in is minimized, print in the first line and in the second line.
If multiple solutions exist, printing any of them will be accepted.
253
286
532
268
We have , whole digits sum to .
Other solutions will also be accepted, such as .
345
556
435
565
We have , whole digits sum to .
123
987987
312
799788
We have , whole digits sum to .
11111111111111111111
111111111111111111111111111111
11111111111111111111
111111111111111111111111111111