002-004-010
Password Strength Checker
Hard
Problem Description
Password Strength Checker
In this problem, you will create a program that receives a password string as input, evaluates its strength in three levels (Strong/Medium/Weak) based on character count, and displays the result to standard output.
Learning Objective: Understand string input validation and checking multiple conditions
Overview
Create a program that checks the strength of a password entered by the user. Learn how to check string length.
Specifications
- Receive one string (password) from standard input
- Determine strength based on password length:
- 8 or more characters: output
Strong: {password} - 4 or more but less than 8 characters: output
Medium: {password} - Less than 4 characters: output
Weak
- 8 or more characters: output
Input Format
mypassword123
Output Format
Strong case:
Strong: mypassword123
Medium case:
Medium: pass
Weak case:
Weak
Hints
- Get string length using the
.length()method - Use
if-else if-elseto check multiple conditions in order
Ready to Try Running Code?
Log in to access the code editor and execute your solutions for this problem.
Don't have an account?
Sign Up