#C10296. Generate Secure Password
Generate Secure Password
Generate Secure Password
Given an integer n, generate a random alphanumeric password of length n that satisfies the following conditions:
- It must contain at least one uppercase letter.
- It must contain at least one lowercase letter.
- It must contain at least one digit.
If n < 3, the password cannot be generated. In that case, output the exact error message: Error: Length of password must be at least 3
.
You are required to read the input from stdin and output the result to stdout. The generated password should be random and different for multiple valid executions.
inputFormat
The input consists of a single line containing one integer n
representing the required length of the password.
outputFormat
If n < 3
, print the error message Error: Length of password must be at least 3
.
Otherwise, print a randomly generated alphanumeric string of length n
that contains at least one uppercase letter, one lowercase letter, and one digit.
8
A1b2C3d4
</p>