题解 | #密码检查#

密码检查

https://www.nowcoder.com/practice/f2fbd8f61c564ca0b5feaa63ab42dae5

#include <stdio.h>
#include <ctype.h>
#include <string.h>
int main() {
    int n = 0;
    scanf("%d", &n);
    while (n--) {
        char str[101];
        scanf("%s", str);
        if (strlen(str) < 8 || isdigit(str[0])) {
            printf("NO\n");
            continue;
        }
        int upper = 0, lower = 0, digit = 0;
        for (int i = 0; str[i] != '\0'; i++) {
            if (islower(str[i]))
                lower++;
            else if (isupper(str[i]))
                upper++;
            else if (isdigit(str[i]))
                digit++;
            else {
                printf("NO\n");
                goto a;
            }
        }
            if(((lower>0)+(digit>0)+(upper>0))<2)
            {
                printf("NO\n");
                continue;
            }
            printf("YES\n");
         a:
         ;
    }
    return 0;
}

全部评论

相关推荐

仁者伍敌:服务员还要脱颖而出,这是五星级酒店吗
点赞 评论 收藏
分享
07-01 13:37
门头沟学院 Java
steelhead:不是你的问题,这是社会的问题。
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务