Practice
StringsCoreIGCSE 0478

Check a password length

LENGTH string routine practice: accept a password only when it has at least 8 characters.

A password is valid when it has 8 or more characters.

Write pseudocode that reads a password and outputs Valid or Too short.

Your program should

  • Declare a STRING variable for the password.
  • Use LENGTH(Password) to test the length.
  • Output Valid or Too short.

Sample input

secret12

Sample output

Valid

Starter

Pseudocode
// Read a password. Output "Valid" if LENGTH is 8 or more, otherwise "Too short".
DECLARE Password : STRING