题目要求:
代码:
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
sc.nextLine();
for (int i = 0; i < n; i++) {
String s = sc.nextLine();
if (s.length() < 6){
System.out.println("Your password is tai duan le.");
continue;
}else if (!s.matches("[a-zA-Z0-9.]+")){
System.out.println("Your password is tai luan le.");
continue;
}else if (!s.matches(".*[0-9].*")){
System.out.println("Your password needs shu zi.");
continue;
}else if (!s.matches(".*[a-zA-Z].*")){
System.out.println("Your password needs zi mu.");
continue;
}else {
System.out.println("Your password is wan mei.");
}
}
}
}
结果: