isPasswordValid

Checks if the string is a valid password based on the specified criteria.

Return

true if the string is a valid password, false otherwise.