fork(1) download
  1. # your code goes here
  2. testStr = "gdsfgfdhjghfgsdf"
  3.  
  4. def sortBy(item):
  5. return item[1]
  6.  
  7. result = sorted([[str(c), testStr.count(c)] for c in set(testStr)], key=sortBy, reverse=True)
  8.  
  9. print(";".join('"{}"={}'.format(i[0], i[1]) for i in result))
Success #stdin #stdout 0.02s 9236KB
stdin
Standard input is empty
stdout
"f"=4;"g"=4;"d"=3;"s"=2;"h"=2;"j"=1