当前位置:网站首页>1081 Check Password (15 points)

1081 Check Password (15 points)

2022-08-11 07:48:00 dumb bit

题目要求:
在这里插入图片描述
在这里插入图片描述
代码:

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.");
            }
        }
    }
}

结果:
在这里插入图片描述

原网站

版权声明
本文为[dumb bit]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/223/202208110645413564.html