import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
Scanner console = new Scanner(System.in);
int max = Integer.MAX_VALUE;
int max2 = Integer.MAX_VALUE;
int first = 0;
int second = 0;
while (console.hasNextInt()) {
int token = console.nextInt();
if (token < max) {
max = token;
first = max;
} else if (token < max2 && token > first) {
max2 = token;
second = max2;
}
}
System.out.println(second);
}
}package com.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 max = Integer.MAX_VALUE;
int max2 = Integer.MAX_VALUE;
int first = 0;
int second = 0;
while (console.hasNextInt()) {
int token = console.nextInt();
if (token < max) {
max = token;
first = max;
} else if (token < max2 && token > first) {
max2 = token;
second = max2;
}
}
System.out.println(max2);
}
}