public class Solution {
public static void main(String[] args) {
Scanner console = new Scanner(System.in);
int min = Integer.MAX_VALUE;
int secmin = Integer.MAX_VALUE;
while (console.hasNextInt()) {
int x = console.nextInt();
if (x < min) {
min = x;
}
else if (min <= secmin){
secmin = x;
}
}
System.out.println(secmin);
}
}
package ua.javarush.task.pro.task04.task0410;
import java.util.Scanner;
/*
Друге мінімальне число серед уведених
*/
public class Solution {
public static void main(String[] args) {
Scanner console = new Scanner(System.in);
int min = Integer.MAX_VALUE;
int secmin = Integer.MAX_VALUE;
while (console.hasNextInt()) {
int x = console.nextInt();
if (x < min) {
min = x;
}
else if (min <= secmin){
secmin = x;
}
}
System.out.println(secmin);
}
}