It is very hard to remember my password, so I came up with a way to generate a password.
The way I generate my password is from a word or a sentence, following these steps:
Start from left to right
Find the count of each letter
Put letter with its count in an order
Letters with higher repetition will be in the end
Letters with the same repetition will be ordered alphabetically
Numbers and special letters will be ignored including whitespace (e.g. 9, 4, @, (, *, etc. are ignored)
Group letters ignoring case. In the output, use the case of the last occurrence in the input
- The count of the letter can be any number e.g. 5H17M345K
- If input is all numbers or special letters then output will be empty string e.g. Input "12$*34^!" then output ""
- when order for the same occurrence alphabetically case does not matter e.g. 1a1B1c
Input: Kitkat Tango (2k / 1i / 3T / 2a / 1n / 1g / 1o) Output: 1g1i1n1o2a2k3T
Input: Database Partitions Task (1D / 5a / 4T / 1b / 3s / 1e / 1P / 1r / 2i / 1o / 1n / 3s / 1k) Output: 1b1D1e1k1n1o1P1r2i3s4T5a
Note: the letters with 1 repeat are in the beginning ordered alphabetically then the letters with more reps
This is code-golf, the shortest code wins.