Problem:
Sorting Three Numbers

Write a program which reads three integers, and prints them in ascending order.

Input

Three integers separated by a single space are given in a line.

Output

Print the given integers in ascending order in a line. Put a single space between two integers.

Constraints

1 ≤ the three integers ≤ 10000

Sample Input 1

3 8 1

Sample Output 1

1 3 8

Solution in JAVA (judge verdict: Wrong Answer)

import java.io.*;

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

        String[] line = reader.readLine().split(" ");
        int[] num = new int[line.length];
        for (int i = 0; i < line.length; i++) {
            num[i] = Integer.parseInt(line[i]);
        }

        for (int i = 0; i < num.length - 1; i++) {
            int minValue = num[i];
            int minIndex = i;
            for (int j = i + 1; j < num.length; j++) {
                if (num[i] > num[j]) {
                    minValue = num[j];
                    minIndex = j;
                }
                int w = num[i];
                num[i] = num[j];
                num[j] = w;
            }
        }

        for (int i : num) {
            System.out.print(num + " ");
        }
    }
}