Password Generator
InterviewTime limit2sMemory limit512 MB
Build any length-n string of letters and digits meeting minimum counts of uppercase, lowercase, and digit characters, with no two equal adjacent characters.
- Level
Medium4 of 10
- Topics
- Greedy, Implementation, String, Math
- Solved
- No attempts yet
Problem
After a series of leaks of confidential information, the public began to think seriously about which passwords to use. For example, the password <<11111>> is simple and should not be used. But how do you tell whether a password is good?
The Business Process Standardization Foundation conducted a study showing that a good password must be long enough and contain characters of different kinds. The study showed that a good password must have exactly characters. The password must consist of uppercase and lowercase Latin letters and digits, and satisfy the following requirements:
- the password must contain at least uppercase letters;
- the password must contain at least lowercase letters;
- the password must contain at least digits;
- the password must not contain two identical consecutive characters.
Realizing that users would find it uncomfortable to invent a password satisfying all these requirements, the Foundation's staff decided to write a program to help users with this task.
Help the Foundation: write a program that, given the parameters, generates a suitable password.
Input
The first line of the input contains the integer , the required password length (). The second line contains the non-negative integers , and , the minimum required number of uppercase letters, lowercase letters and digits, respectively ().
Output
In a single line, output any good password. Only uppercase and lowercase Latin letters and digits may be used.