import java.util.*;
public class Main {
public static int n = 0;
public static void main(String[] args) {
int n = 3;
HashSet<String> test;
String[] inputArr;
Scanner in = new Scanner(System.in);
while (n > 0) {
System.out.println("\nВведите строку: ");
inputArr = in.nextLine().split(" ");
test = new HashSet<String>();
for (int i=0; i<inputArr.length; i++) {
if (Integer.parseInt(inputArr[i])>9) {
for (int j=i+1; j<inputArr.length; j++) {
if (!inputArr[i].equals(inputArr[j]) && inputArr[i].length() == inputArr[j].length()) {
String[] temp1 = inputArr[i].split("");
String[] temp2 = inputArr[j].split("");
boolean check1 = Arrays.asList(temp1).containsAll(Arrays.asList(temp2));
boolean check2 = Arrays.asList(temp2).containsAll(Arrays.asList(temp1));
if (check1 && check2) {
test.add(inputArr[i]+'-'+inputArr[j]);
}
}
}
}
}
System.out.println("Одинаковые числа: " + test);
n -= 1;
}
}
}
<!DOCTYPE html>
<html>
<head>
<title>Testing</title>
</head>
<body>
<script>
function srav(){
var diag_nap_uchr = document.getElementById('pass-old');
var diag_osn = document.getElementById('pass-new');
if (diag_nap_uchr.value === diag_osn.value){
alert ("Совпадение");
}
}
</script>
<input type="password" id="pass-old" class="field-custom" placeholder="Старый пароль" name="password" value="123456">
<input type="password" id="pass-new" class="field-custom" placeholder="Новый пароль" name="password" oninput="srav()">
</body>
</html>