#PHP <s>135</s> 146 Bytes I know I'm late but I wanted to post anyway: function a($b){ $b=strtoupper($b); foreach(range('A','Z') as $c){ $d[$c]=substr_count($b, $c); } arsort($d); return implode(array_keys($d)); } echo a($z); //let $z be the supplied string. golfed: function a($b){$b=strtoupper($b);foreach(range('A','Z') as $c){$d[$c]=substr_count($b, $c);}arsort($d);return implode(array_keys($d));}echo a($z);