002-004-010

Password Strength Checker

Hard

Problem Description

Password Strength Checker

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

  1. Receive one string (password) from standard input
  2. 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

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-else to 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?