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;
class Main{
   public static void main(String[] args){
     Scanner scanner = new Scanner(System.in);
     int a,b,c,x,y,z;
     a = scanner.nextInt();
     b = scanner.nextInt();
     c = scanner.nextInt();

     y = 0;

     if(a>b){
       x = a;
     }else x = b;

     if(x<c)x = c;

     if(a<b){
       z = a;
     }else z =b;

     if(z>c)z = c;

     if(a!=x&&a!=z)y = a;
     if(b!=x&&b!=z)y = b;
     if(c!=x&&c!=z)y = c;

     if(a==b||a==c||b==c){
       if((a==b&&a==x)||(a==c&&a==x)||(b==c&&b==x)){
         y = x;
       }else y = z;
     }


     System.out.println(z +" "+ y +" "+ x);

  }
}