вроде чекал с минусами работает норм
package com.javarush.task.pro.task04.task0410;
import java.security.spec.RSAOtherPrimeInfo;
import java.util.Scanner;
/*
Второе минимальное число из введенных
*/
public class Solution {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int y = 0;
int t;
int mas[] = new int[2];
mas[0] = Integer.MAX_VALUE;
mas[1] = Integer.MAX_VALUE;
while (true) {
String s = scanner.nextLine();
try {
t = Integer.parseInt(s);
} catch (Exception e) {
break;
}
y++;
if (mas[0] > t) {
mas[1] = mas[0];
mas[0] = t;
} else {
if (mas[1] > t && mas[0]!=t) {
mas[1] = t;
}
}
}
if (y>1) System.out.println(mas[1]);
}
}