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: Accepted)

public class Main
{
	public static void main(String[] args) throws java.io.IOException
	{
		java.io.BufferedReader br = new java.io.BufferedReader( new java.io.InputStreamReader( System.in ) );
		
		String[] st = br.readLine().split(" ");
		int[] nums = new int[st.length];
		for( int i = 0 ; i < nums.length ; i++ ) nums[i] = Integer.parseInt( st[i] );
		
		
		int x;
		boolean exchange = true;
		while( exchange )
		{
			exchange = false;
			for( int i = 0 ; i < (nums.length - 1) ; i++ )
			{
				if( nums[i] > nums[i+1] )
				{
					x = nums[i];
					nums[i] = nums[i+1];
					nums[i+1] = x;
					exchange = true;
				}
			}
		}
		
		String result = "";
		for( int i = 0 ; i < nums.length ; i++ )
		{
			 if( i < (nums.length -1) ){
				 result += ( nums[i] + " " );
			}else{
				result += nums[i];
			}
		}
		System.out.println( result );
	}
}