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.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String input = sc.nextLine();
		String output = "";
		String[] sdata = input.split(" ");
		int[] idata = new int[3];
		boolean condition = true; // 入力された数値が条件範囲内かを確認するための変数
		int temp = 0; // 一時的にデータを保存しておく変数
		int number = 0; // 一時的にデータの要素番号を保存しておく変数

		for (int i = 0; i < sdata.length; i++) {
			idata[i] = Integer.parseInt(sdata[i]);
			if (idata[i] <= 0 || idata[i] > 1000) {
				condition = false;
				break;
			}
		}

		if (condition) {
			for (int i = 0; i < idata.length - 1; i++) {
				temp = idata[i];
				for (int j = i + 1; j < idata.length; j++) {
					if (idata[j] < temp) {
						temp = idata[j];
						number = j;
					}
				}
				idata[number] = idata[i];
				idata[i] = temp;

			}

			for (int i = 0; i < idata.length; i++) {
				output += idata[i] + " ";

			}
			System.out.println(output);
		}
	}

}