SORTING - Sorting is easy

 

Do you think sorting is easy?

try your luck
in brainfuck

 

For those who don't know that brainfuck is a programming language: Take a look at the converter to C. It will ignore every unknown command, therefore submitting a program in any other language won't necessarily lead to compile error, but certainly not to Accepted.

Input

The input consists of a line of up to 1000 uppercase letters, terminated with a '\n' character (ASCII value 10).

Output

The output should contain a line consisting of the same characters as the input line, but in non-descending order.

Example

Input:
BRAINFUCK

Output:
ABCFIKNRU

Added by:Adrian Kuegel
Date:2004-11-04
Time limit:1s
Source limit:500B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:BF
Resource:own problem

hide comments
2020-09-02 20:53:52 Rafail Loizou
[BEFORE] I solved it but with more that 500 characters of code which is the source limit.I tried to make the code smaller but I can't go under 700 characters of code. For a BF problem shouldn't the source limit be higher?
[AFTER SOLVING] OK it is possible to solve it with less than 500 characters you just need to be a little paranoid with it and you will finally get it.
[AFTER REALIZING SOMETHING WAS MISSING] The problem setter should have but did not specify that one cell is enough to count the occurrences of each letter. So you don't have to consider that each cell's size is 8-bits thus the numbers you can represent is [-128,127] and thus plan to use more than one cell to count occurrences of one character. I hope he sees this soon and changes the instruction to include this specification; That the cell size is greater than 8-bits and enough to count up to 1000 which is the limit given. Alternatively and if you think that this gives out the answer then just tell people the cell size provided in the bff 1.0.6 implementation of BF or provide this link so they can calculate it themselves https://esolangs.org/wiki/Brainfuck#Cell_Size


Last edit: 2020-09-07 11:43:47
2014-12-12 09:13:37 Vamsi Krishna Avula
Its easier than I expected and of course had a good time debugging.
2014-01-09 02:24:47 Martijn Muijsers
Boom AC in one go! Thinking about it, writing it and debugging it all took me a long time, and I learned a lot! :)
2013-08-18 14:05:14 Mitch Schwartz
I've seen it also on http://www.spoj.com/SHORTEN/problems/ODDBF/ , maybe it's a bug on SPOJ that happens very rarely.
2013-08-18 13:26:01 ওয়াসী (Wasi)
Strange! the problem setter is the best solver. I've never seen this type of thing before.I've tried to solve my own problem FIZZBUZZ(though a tutorial one :P) but my solution didn't appear in the best solver list.
Is it possible for a problem setter to participate in his own problem??
2011-11-03 10:17:36 Jitesh
Thnx.....
2011-11-02 14:29:57 Adrian Kuegel
you don't print the 'Z's
2011-11-02 07:38:57 Jitesh
Firstly i got a TLE n now its giving me a WA....Can any one give some test cases...
2010-08-23 10:55:13 Adrian Kuegel
you need to use brainfuck (check wikipedia if you don't know about it)
2010-08-22 08:28:01 BACK
which language have 2 use...
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.