Problem:
Sorting Five Numbers

Write a program which reads five numbers and sorts them in descending order.

Input

Input consists of five numbers a, b, c, d and e (-100000 ≤ a, b, c, d,e ≤ 100000). The five numbers are separeted by a space.

Output

Print the ordered numbers in a line. Adjacent numbers should be separated by a space.

Sample Input

3 6 9 7 5

Output for the Sample Input

9 7 6 5 3

Solution in JAVA (judge verdict: Accepted)

import java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedReader;

public class Main{
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String[] input = br.readLine().split(" ", 5);
        int[] data = new int[5];

        for (int i = 0; i < 5; i++) {
            data[i] = Integer.parseInt(input[i]);
        }

        for (int j = 0; j < 4; j++) {
            for (int i = 4; i > j; i--) {
                if (data[i - 1] < data[i]) {
                    int swp = data[i];
                    data[i] = data[i - 1];
                    data[i - 1] = swp;
                }
            }
        }
        StringBuilder sb = new StringBuilder();

        for (int i : data) {
            sb.append(i);
            sb.append(" ");
        }

        System.out.println(sb.substring(0 , sb.length()-1));
    }
}