Я пытаюсь решить перебором, но очевидно есть способ проще - посмотрите, помогите, пожалуйста
package com.javarush.task.task04.task0441;
/*
Как-то средненько
*/
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
String a1 = r.readLine();
String a2 = r.readLine();
String a3 = r.readLine();
int a = Integer.parseInt(a1);
int b = Integer.parseInt(a2);
int c = Integer.parseInt(a3);
if (a <= b && b <= c)
System.out.println(b);
else {
if (a <= c && c <= b)
System.out.println(c);
else {
if (b <= a && a <= c)
System.out.println(a);
else {
if (a == b || b == c)
System.out.println(b);
else {
if (b <= a && b <= c && a <= c)
System.out.println(a);
else {
if (a == c)
System.out.println(c);
else {
if (a == c && b == c && a == b)
System.out.println(b);
}
}
}
}
}
}
}
}
//напишите тут ваш код