\$\begingroup\$We don't have to print the sentences Give me a string: and The signature signature of 'this' is right? We can just take the input directly and print the result?\$\endgroup\$
– FatalizeAug 19 '15 at 7:24

4

\$\begingroup\$What about duplicate letters? e.g. is the signature of broombmoor or bmor?\$\endgroup\$
– samgakAug 19 '15 at 7:39

\$\begingroup\$@Tim I don't think we should have challenges that are this straightforward. I'll ask about it on meta - it's not really about this question in particular.\$\endgroup\$
– isaacgAug 19 '15 at 11:00

2

\$\begingroup\$I think this would have been a more interesting challenge if you couldn't use built-in sorting functions.\$\endgroup\$
– Glen OAug 20 '15 at 4:34

Brainfuck, 40 bytes

The code requires a left-infinite or wrapping tape of 8 bit cells. Try it online!

How it works

, Read a char from STDIN.
[ While the byte under the pointer (last read char) is non-zero:
>>+ Move the pointer two steps to the right and increment.
>>, Move the pointer two steps to the right and read a char.
]
<< Move the pointer two steps to the left.
If the input was "sort", the tape now contains the following:
0 0 115 0 1 0 111 0 1 0 114 0 1 0 116 0 1 0 0
^
[ While the byte under the pointer is non-zero:
[<<] Advance two steps to the left until a null byte is encountered.
>> Advance two steps to the right.
This will place the pointer on the first input character.
[ While the byte under the pointer is non-zero:
- Decrement.
[<] Move the pointer to the left until a null byte is encountered.
>> Move the pointer two steps to the right.
If the decremented character is non-zero, [<] will move to the
null byte before it, so >> brings the pointer to the null byte
after it. If the decremented character is zero, [<] is a no-op, so
>> advances two steps to the right, to a non-zero byte.
[ While the byte under the pointer is non-zero:
. Print the char under the pointer.
<<- Move the pointer two steps to the left and decrement.
> Move the pointer to the right.
]
If the decremented character gave zero, this will print the value
of the accumulator after it, and decrement the character once more
to make it non-zero, then place the pointer to the right of the
character, thus exiting the loop.
>+ Move the pointer to the right and increment.
This increments the accumulator each time an input character is
decremented.
>> Move the pointer two steps to the right.
This moves the pointer to the next character.
]
<< Move the pointer two steps to the left.
This moves the pointer to the accumulator of the last character.
]
After 255, th accumulator wraps around to 0, and the loop ends.

JavaScript, 34 bytes

alert([...prompt()].sort().join``)

The reason this is so long is that JavaScript can only sort arrays, so the string must be split into an array, sorted, and then joined back into a string. This is ECMAScript 6; the equivalent in ES5 is:

\$\begingroup\$You can use repr to bring it down another byte (Now you know why I chose Python 3 version of the solution :P) - print`sorted(raw_input())`[2::5] (Those are backticks, not single quotes)\$\endgroup\$
– KamehamehaAug 19 '15 at 9:53

\$\begingroup\$@Mauris Wow, I didn't think that not using the builtin sort would be shorter! Only problem though - is there a way to echo without the trailing newline?\$\endgroup\$
– Sp3000Aug 20 '15 at 0:08

Your Answer

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).

Post as a guest

Post as a guest

Code Golf Stack Exchange is a site for recreational programming competitions, not general programming questions. Challenges must have an objective scoring criterion, and it is highly recommended to first post proposed challenges in the Sandbox.