Module: Java. Conditional operator


Problem

9 /17


Machine Simulation

Problem

Write a program that simulates the operation of the following machine. The machine takes a three-digit number as input and constructs a new number as follows:

  1. Calculate the sum of the first and second digits, followed by the sum of the second and third digits.
  2. Write these sums in non-increasing order.

For example, for the number 639, we calculate the sums: 6 + 3 = 9; 3 + 9 = 12. The result is: 129. Write a program that implements the operation of this machine.
 

Input format 
The program should take a single number, n (100 <= n <= 999), as input.

Output format 
The program should output the new number.

 
Example
N Input Output
1 654 119