Generate password code golf
$begingroup$
just another way to create a password
it is very hard to remember my password, so I came up with a way to create a password that i can generate
The way i generate my password is from a word or a sentence and follow these steps
1- start from left to right
2- find the count of each letter
3- put letter with its count in an order
letter with higher repetition will be in the end
letters with the same repetition will be ordered alphabetically
4- numbers and special letters will be ignored including white space, 9, 4, @, (, *, etc.
5- keep the case for the last letter
examples will make things clearer
Kitkat Tango
2k / 1i / 3T / 2a / 1n / 1g / 1o
1g1i1n1o2a2k3T
another example
Database Partitions Task
1D/5a/4T/1b/3s/1e/1P/1r/2i/1o/1n/3s/1k
1b1D1e1k1n1o1P1r2i3s4T5a
note the letters with 1 repeat are in the beginning ordered alphabetically
then the letters with more reps
the shortest code wins
code-golf word-puzzle
$endgroup$
add a comment |
$begingroup$
just another way to create a password
it is very hard to remember my password, so I came up with a way to create a password that i can generate
The way i generate my password is from a word or a sentence and follow these steps
1- start from left to right
2- find the count of each letter
3- put letter with its count in an order
letter with higher repetition will be in the end
letters with the same repetition will be ordered alphabetically
4- numbers and special letters will be ignored including white space, 9, 4, @, (, *, etc.
5- keep the case for the last letter
examples will make things clearer
Kitkat Tango
2k / 1i / 3T / 2a / 1n / 1g / 1o
1g1i1n1o2a2k3T
another example
Database Partitions Task
1D/5a/4T/1b/3s/1e/1P/1r/2i/1o/1n/3s/1k
1b1D1e1k1n1o1P1r2i3s4T5a
note the letters with 1 repeat are in the beginning ordered alphabetically
then the letters with more reps
the shortest code wins
code-golf word-puzzle
$endgroup$
$begingroup$
By 'count in each letter', do you mean how many times a letter appears in the input sentence?
$endgroup$
– Embodiment of Ignorance
4 hours ago
$begingroup$
Can a letter appear more than 9 times?
$endgroup$
– Shaggy
40 mins ago
add a comment |
$begingroup$
just another way to create a password
it is very hard to remember my password, so I came up with a way to create a password that i can generate
The way i generate my password is from a word or a sentence and follow these steps
1- start from left to right
2- find the count of each letter
3- put letter with its count in an order
letter with higher repetition will be in the end
letters with the same repetition will be ordered alphabetically
4- numbers and special letters will be ignored including white space, 9, 4, @, (, *, etc.
5- keep the case for the last letter
examples will make things clearer
Kitkat Tango
2k / 1i / 3T / 2a / 1n / 1g / 1o
1g1i1n1o2a2k3T
another example
Database Partitions Task
1D/5a/4T/1b/3s/1e/1P/1r/2i/1o/1n/3s/1k
1b1D1e1k1n1o1P1r2i3s4T5a
note the letters with 1 repeat are in the beginning ordered alphabetically
then the letters with more reps
the shortest code wins
code-golf word-puzzle
$endgroup$
just another way to create a password
it is very hard to remember my password, so I came up with a way to create a password that i can generate
The way i generate my password is from a word or a sentence and follow these steps
1- start from left to right
2- find the count of each letter
3- put letter with its count in an order
letter with higher repetition will be in the end
letters with the same repetition will be ordered alphabetically
4- numbers and special letters will be ignored including white space, 9, 4, @, (, *, etc.
5- keep the case for the last letter
examples will make things clearer
Kitkat Tango
2k / 1i / 3T / 2a / 1n / 1g / 1o
1g1i1n1o2a2k3T
another example
Database Partitions Task
1D/5a/4T/1b/3s/1e/1P/1r/2i/1o/1n/3s/1k
1b1D1e1k1n1o1P1r2i3s4T5a
note the letters with 1 repeat are in the beginning ordered alphabetically
then the letters with more reps
the shortest code wins
code-golf word-puzzle
code-golf word-puzzle
asked 4 hours ago
asmgxasmgx
20418
20418
$begingroup$
By 'count in each letter', do you mean how many times a letter appears in the input sentence?
$endgroup$
– Embodiment of Ignorance
4 hours ago
$begingroup$
Can a letter appear more than 9 times?
$endgroup$
– Shaggy
40 mins ago
add a comment |
$begingroup$
By 'count in each letter', do you mean how many times a letter appears in the input sentence?
$endgroup$
– Embodiment of Ignorance
4 hours ago
$begingroup$
Can a letter appear more than 9 times?
$endgroup$
– Shaggy
40 mins ago
$begingroup$
By 'count in each letter', do you mean how many times a letter appears in the input sentence?
$endgroup$
– Embodiment of Ignorance
4 hours ago
$begingroup$
By 'count in each letter', do you mean how many times a letter appears in the input sentence?
$endgroup$
– Embodiment of Ignorance
4 hours ago
$begingroup$
Can a letter appear more than 9 times?
$endgroup$
– Shaggy
40 mins ago
$begingroup$
Can a letter appear more than 9 times?
$endgroup$
– Shaggy
40 mins ago
add a comment |
3 Answers
3
active
oldest
votes
$begingroup$
05AB1E, 19 bytes
áΣl}.γl}εgyθ‚}Σl}JJ
Try it online!
or as a Test Suite
$endgroup$
add a comment |
$begingroup$
Japt v2.0a0 -P
, 14 bytes
fl üv ñÊ®ÌiZÊ
Try it
f :Split to an array of characters
l : Matching RegEx /[a-z]/gi
ü :Sort & group (Preserves original order within each group)
v : By lowercase
ñ :Sort
Ê : By length
® :Map each Z
Ì : Last element of Z
i : Prepend
ZÊ : Length of Z
:Implicitly join & output
$endgroup$
add a comment |
$begingroup$
Python 2, 99 bytes
def f(s):a=s.lower();return''.join(sorted(`a.count(c)`+s[a.rfind(c)]for c in set(a)if c.isalpha()))
Try it online!
$endgroup$
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
});
});
}, "mathjax-editing");
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "200"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f178888%2fgenerate-password-code-golf%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
05AB1E, 19 bytes
áΣl}.γl}εgyθ‚}Σl}JJ
Try it online!
or as a Test Suite
$endgroup$
add a comment |
$begingroup$
05AB1E, 19 bytes
áΣl}.γl}εgyθ‚}Σl}JJ
Try it online!
or as a Test Suite
$endgroup$
add a comment |
$begingroup$
05AB1E, 19 bytes
áΣl}.γl}εgyθ‚}Σl}JJ
Try it online!
or as a Test Suite
$endgroup$
05AB1E, 19 bytes
áΣl}.γl}εgyθ‚}Σl}JJ
Try it online!
or as a Test Suite
answered 1 hour ago
EmignaEmigna
45.7k432139
45.7k432139
add a comment |
add a comment |
$begingroup$
Japt v2.0a0 -P
, 14 bytes
fl üv ñÊ®ÌiZÊ
Try it
f :Split to an array of characters
l : Matching RegEx /[a-z]/gi
ü :Sort & group (Preserves original order within each group)
v : By lowercase
ñ :Sort
Ê : By length
® :Map each Z
Ì : Last element of Z
i : Prepend
ZÊ : Length of Z
:Implicitly join & output
$endgroup$
add a comment |
$begingroup$
Japt v2.0a0 -P
, 14 bytes
fl üv ñÊ®ÌiZÊ
Try it
f :Split to an array of characters
l : Matching RegEx /[a-z]/gi
ü :Sort & group (Preserves original order within each group)
v : By lowercase
ñ :Sort
Ê : By length
® :Map each Z
Ì : Last element of Z
i : Prepend
ZÊ : Length of Z
:Implicitly join & output
$endgroup$
add a comment |
$begingroup$
Japt v2.0a0 -P
, 14 bytes
fl üv ñÊ®ÌiZÊ
Try it
f :Split to an array of characters
l : Matching RegEx /[a-z]/gi
ü :Sort & group (Preserves original order within each group)
v : By lowercase
ñ :Sort
Ê : By length
® :Map each Z
Ì : Last element of Z
i : Prepend
ZÊ : Length of Z
:Implicitly join & output
$endgroup$
Japt v2.0a0 -P
, 14 bytes
fl üv ñÊ®ÌiZÊ
Try it
f :Split to an array of characters
l : Matching RegEx /[a-z]/gi
ü :Sort & group (Preserves original order within each group)
v : By lowercase
ñ :Sort
Ê : By length
® :Map each Z
Ì : Last element of Z
i : Prepend
ZÊ : Length of Z
:Implicitly join & output
edited 28 mins ago
answered 41 mins ago
ShaggyShaggy
19.3k21666
19.3k21666
add a comment |
add a comment |
$begingroup$
Python 2, 99 bytes
def f(s):a=s.lower();return''.join(sorted(`a.count(c)`+s[a.rfind(c)]for c in set(a)if c.isalpha()))
Try it online!
$endgroup$
add a comment |
$begingroup$
Python 2, 99 bytes
def f(s):a=s.lower();return''.join(sorted(`a.count(c)`+s[a.rfind(c)]for c in set(a)if c.isalpha()))
Try it online!
$endgroup$
add a comment |
$begingroup$
Python 2, 99 bytes
def f(s):a=s.lower();return''.join(sorted(`a.count(c)`+s[a.rfind(c)]for c in set(a)if c.isalpha()))
Try it online!
$endgroup$
Python 2, 99 bytes
def f(s):a=s.lower();return''.join(sorted(`a.count(c)`+s[a.rfind(c)]for c in set(a)if c.isalpha()))
Try it online!
answered 35 mins ago
TFeldTFeld
14.5k21241
14.5k21241
add a comment |
add a comment |
If this is an answer to a challenge…
…Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.
…Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
Explanations of your answer make it more interesting to read and are very much encouraged.…Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.
More generally…
…Please make sure to answer the question and provide sufficient detail.
…Avoid asking for help, clarification or responding to other answers (use comments instead).
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f178888%2fgenerate-password-code-golf%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
$begingroup$
By 'count in each letter', do you mean how many times a letter appears in the input sentence?
$endgroup$
– Embodiment of Ignorance
4 hours ago
$begingroup$
Can a letter appear more than 9 times?
$endgroup$
– Shaggy
40 mins ago