#C5746. Random Password Generator
Random Password Generator
Random Password Generator
You are given a single integer L representing the desired length of a password. Your task is to generate a random password of exactly L characters that meets the following conditions:
- The password must contain at least one lowercase letter.
- The password must contain at least one uppercase letter.
- The password must contain at least one digit.
- The password must contain at least one special character from the set \( !@#$%^&*()-_=+\[\]{}|;:,.?/ \).
If L is not in the range \([8,16]\) (inclusive), output Invalid length
. When L is valid, generate the password by first selecting one character from each required category, then filling the remaining positions with random selections from the union of all allowed characters, and finally shuffling the characters to avoid any predictable order. For the purpose of deterministic output in testing, you should seed your random generator with the value L.
inputFormat
The input consists of a single line containing an integer L, the desired length of the password.
outputFormat
If L is between 8 and 16 (inclusive), output a valid password of length L that satisfies the conditions. Otherwise, output Invalid length
.
5
Invalid length
</p>