输入第一行给出一个正整数 N(≤ 100),随后 N 行,每行给出一个用户设置的密码,为不超过 80 个字符的非空字符串,以回车结束。
输出格式:
对每个用户的密码,在一行中输出系统反馈信息,分以下5种:
如果密码合法,输出Your password is wan mei.; 如果密码太短,不论合法与否,都输出Your password is tai duan le.; 如果密码长度合法,但存在不合法字符,则输出Your password is tai luan le.; 如果密码长度合法,但只有字母没有数字,则输出Your password needs shu zi.; 如果密码长度合法,但只有数字没有字母,则输出Your password needs zi mu.。
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.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader;publicclassMain{publicstaticvoidmain(String[] args)throws IOException {BufferedReader bf &#61;newBufferedReader(newInputStreamReader(System.in));int n &#61; Integer.parseInt(bf.readLine());for(int i&#61;0;i<n;i&#43;&#43;){String s &#61; bf.readLine();if(s.length()<6){System.out.println("Your password is tai duan le.");continue;}else{boolean num&#61;false,letter&#61;false,law&#61;true;for(int j&#61;0;j<s.length();j&#43;&#43;){if(!Character.isLetterOrDigit(s.charAt(j))&&s.charAt(j)!&#61;&#39;.&#39;){law&#61;false;break;}elseif(Character.isDigit(s.charAt(j)))num&#61;true;elseif(Character.isLetter(s.charAt(j)))letter&#61;true;}if(law&#61;&#61;false) System.out.println("Your password is tai luan le.");elseif(letter&#61;&#61;false) System.out.println("Your password needs zi mu.");elseif(num&#61;&#61;false) System.out.println("Your password needs shu zi.");else System.out.println("Your password is wan mei.");}}} }