Generating passwords

Report a typo

A password is hard to crack if it contains at least A uppercase letters, at least B lowercase letters, at least C digits and consists of exactly N symbols. Also, a password cannot contain two or more of the same characters in a row.

For the given numbers A, B, C, and N, you should output a password that matches these requirements.

It is guaranteed that A, B, C, and N are non-negative integers, and A + B + C <= N. Keep in mind that any parameter can be equal to zero. It means that it's ok if the password doesn't contain symbols of such type.

Sample Input 1:

3 2 3 10

Sample Output 1:

ABAab121AB

Sample Input 2:

1 0 0 1

Sample Output 2:

A

Sample Input 3:

0 1 0 1

Sample Output 3:

a
Write a program in Java 17
import java.util.*;

public class Main {
public static void main(String[] args) {
// write your code here
}
}
___

Create a free account to access the full topic