Everyone has to use passwords. One can choose a password from poems, songs, movies names and so on. Unfortunately, some passwords can be easily guessed from lists of common cultural references. You can make your passwords stronger through different means, such as writing a function to do the following:
Rules:
Select some text in capital letters, optionally including digits and non alphabetic characters,
Shift each letter by a given number but the transformed letter must be a letter (circular shift),
Replace each digit by its complement to 9,
Keep such as non alphabetic and non digit characters,
Lowercase each letter in odd position, uppercase each letter in even position (the first character is in position 0),
reverse the whole result.
Example:
your text: "BORN IN 2015!", shift 1 1 + 2 + 3 -> "CPSO JO 7984!" 4 "CpSo jO 7984!" 5 "!4897 Oj oSpC"
With longer passwords, isn't it better to have a small and easy program? How would you write it?
This challenge comes from g964 on CodeWars. Thank you to CodeWars, who has licensed redistribution of this challenge under the 2-Clause BSD License!
Want to propose a challenge idea for a future post? Email yo+challenge@dev.to with your suggestions!
Top comments (1)
Haskell solution, will happily answer questions: