Sample input:
5
123S
zheshi.wodepw
1234.5678
WanMei23333
Pass * word.6
Sample output:
Your password is tai duan le.
Your password needs shu zi.
Your password needs zi mu.
Your password is wan mei.
Your password is tai luan le.
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int n = input.nextInt();
input.nextLine();
for (int i = 0; i < n; i++) {
boolean neednum = true, needletter = true, luan = false;
String password = input.nextLine();
if (password.length() < 6) {
System.out.println("Your password is tai duan le.");
continue;
} else {
for (int j = 0; j < password.length(); j++) {
if (!Character.isLetterOrDigit(password.charAt(j)) && password.charAt(j) != '.') {
luan = true;
break;
} else if (Character.isDigit(password.charAt(j))) {
neednum = false;
} else if (Character.isLetter(password.charAt(j))) {
needletter = false;
}
}
if (luan) {
System.out.println("Your password is tai luan le.");
continue;
} else if (neednum) {
System.out.println("Your password needs shu zi.");
continue;
} else if (needletter) {
System.out.println("Your password needs zi mu.");
continue;
} else {
}
System.out.println("Your password is wan mei.");
}
}
input.close();
}
}