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)

import java.util.Scanner;
import java.util.ArrayList;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int[] list = new int[3];
		list[0] = sc.nextInt();
		list[1] = sc.nextInt();
		list[2] = sc.nextInt();
		
		change(list);
		for (int i = 0; i < list.length; i++){
			System.out.print(list[i]);
			if (i == 2){
				continue;
			}
			System.out.print(" ");
		}
		System.out.println();
		
	}
	
	public static void change(int[] li){
		for (int j = 0; j < li.length - 1; j++){
			for (int i = 0; i < li.length - j - 1; i++){
				if(li[i] > li[i+1]){
					int tmp = li[i];
					li[i] = li[i+1];
					li[i+1] = tmp;
				}
			}
		}
	}
}