I need to remember a lot of passwords and don't want to use the same one for multiple websites so I came up with a rule, but the rule shouldn't be transparent so what I do is:
- Think of a long word or concept such as
- Replace the first letter with the site we are logging into. If we are logging into
- Make the first letter uppercase.
- Change the second letter to an
- If the password starts with a non-consonant, add a certain number (such as
1234); otherwise, add another number (such as
Ta da, you now have an adequate password.
This process is arduous though so I need a program to generate this for me based on the following:
a: the initial word, which is a string and is always lowercase, and is guaranteed to be longer than 3 characters.
b: the site we are logging into, which is a string and is always lowercase, and is guaranteed to be non-empty.
c: the number for non-consonants, which is a positive integer that may have leading zeroes.
d: the number for consonants, which is a positive integer that may have leading zeroes.
Output a string based on above criteria.
a="volvo", b="gmail", c=5555, d="0001"
a="sherlock", b="9gag", c=31415926535, d=3
a="flourishing", b="+google", c=11111, d=2222
yis a consonant.
- If you decide
dis an integer, you may parse it as such, and leading zeroes can be ignored (
0091gets treated as
- Trailing whitespace and newlines are allowed.
- You may output the result to STDOUT or return the result in a function.
- Characters allowed in
- You may accept the 4 inputs in any consistent order.
This is code-golf. Shortest code in bytes wins.