I forgot which characters are uppercase and downcase in a password, how do I make a function that prints all variations?
Sorta like this:
>password
>passworD
>passwoRd
>passwoRD
>passwOrd
And so on,you get the drill. It doesn't have to be in this order tho
The simplest way would be to make it recursive.
Make a function that takes 2 arguments: the candidate string (CS) and the remaining string (RS). At first CS is empty and RS is the base password (e.g. "password").
Inside the function, you try the password if CS has the length of your password, if it's shorter, take the first character from RS and call that same function using CS concatenated with that first character as CS and RS without the first character as RS. Do that for both the upper case and the lower case. In this case the first call to the function would be function("","password") and the first recursive calls would be function("P", "assword") and function("p","assword"), then it will be function ("PA", "ssword"), function("pA","ssword") and so on.