Restoring Numbers


Submit solution

Points: 1
Time limit: 1.0s
Python 3.0s
Memory limit: 500M

Author:
Problem type
Allowed languages
C, C++, Java, Python

James has thought of three positive integers \(a, b\) and \(c\) to use as a secret pin for the UCC vending machine. He then writes down their pairwise sums and total sum in arbitrary order on the clubroom whiteboard. So, there are four numbers on the whiteboard \(a + b, a + c, b + c\) and \(a + b + c\) in a random order.

You, wanting unlimited snacks and beverages long to find \(a, b\) and \(c\). Print them in ascending order.

Note that it is possible for any of these numbers to match.

Input Specification

One line. Four space-separated positive integers \(x_1, x_2, x_3, x_4 (2 \leq x_i \leq 10^9)\) in random order. It is guaranteed that an answer exists.

Output Specification

Print \(a,b\) and \(c\) in ascending order. It is guaranteed that the answer exists. If there are several answers, print the smallest.

Sample Input 1

3 6 5 4

Sample Output 1

1 2 3

Sample Input 2

10 10 10 15

Sample Output 2

5 5 5

Comments

There are no comments at the moment.