Eating Candy in the Correct Order When it comes to eating candy, I hold myself to higher standards than the typical layperson.  There is a delicate balance between "mixing it up" and "saving the best for last."

In this challenge, you will be given a string of characters in which each character represents a piece of candy.  Different characters (case-sensitive) represent different types of candy. Your program must then determine the correct order of candy consumption, based on the procedure below. You can write either a complete program (STDIN/STDOUT) or a named function to accomplish this task.

Let's say that my candy stash is oroybgrbbyrorypoprr.  First, I sort the candy into piles of the same type, with larger quantities at the top, using lower ASCII character values as a tie-breaker.

rrrrrr
oooo
bbb
yyy
pp
g


Then, I take each row of candy and equally-space them along an interval.  For example, if there are 3 pieces of candy, one is placed 1/3 of the way, 2/3 of the way, and at the end.

.r.r.r.r.r.r
..o..o..o..o
...b...b...b
...y...y...y
.....p.....p
...........g


Then, I go down each column to create my final candy order, rorbyroprbyorrobypg.

Input

A string which contains the candy stash.  The input for the above example could have been:

oroybgrbbyrorypoprr


Output

A string containing the candy reorganized into the correct order of consumption.

rorbyroprbyorrobypg


Scoring

This is code golf.  The shortest answer in bytes wins.  Standard code-golf rules apply.
CJam, 78 68 61 45 42 39 31 30 bytes
l$:L{L\/,~}${:DM+:MD/,LD/,d/}$

Takes the input string via STDIN
Inspired by recursive's approach, but a little different. No need of transpose or rectangle at all!.
How it works:
l$:L                              &quot;Sort the input line and store it in L&quot;;
    {     }$                      &quot;Sort the string based on this code block output&quot;;
     L\/,~                        &quot;Sort based on number of occurrences of each&quot;;
                                  &quot;character in the full string&quot;;
            {               }$    &quot;Sort the sorted string again&quot;;
             :DM+:M               &quot;Store each character in D, add to M and update M&quot;;
                   D/,            &quot;Count occurrences of D in M&quot;;
                      LD/,        &quot;Count occurrences of D in L&quot;;
                          d/      &quot;Sort string based on the ratio of two occurrences&quot;;

(Sad that CJam can no longer complete with Pyth due to need of so much bloat as syntax)
Try it here