Given a string, s, return a new string that orders the characters in order of frequency. 

The returned string should have the same number of characters as the original string. 

Make your transformation stable, meaning characters that compare equal should stay in their original order in the string s. 

```python
most_common("Hello world") => "lllooHe wrd"
most_common("Hello He worldwrd") => "lllHeo He wordwrd"
```

Explanation:

In the `hello world` example, there are 3 `'l'`characters, 2 `'o'`characters, and one each of `'H'`, `'e'`, `' '`, `'w'`, `'r'`, and `'d'`characters. Since `'He wrd'`are all tied, they occur in the same relative order that they do in the original string, `'Hello world'`.

Note that ties don't just happen in the case of characters occuring once in a string. See the second example, `most_common("Hello He worldwrd")`should return `'lllHeo He wordwrd'`, not `'lllHHeeoo  wwrrdd'`.  **This is a key behavior if this method were to be used to transform a string on multiple passes.**

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def most_common(s):
	

Solutions:
from collections import Counter

def most_common(s):
	count = Counter(s)
	return ''.join(sorted(s, key=lambda c: -count[c]))


def most_common(s):
	return ''.join(sorted(s, key=s.count, reverse=True))


def most_common(stg):
	return ''.join(sorted(stg, key=stg.count, reverse=True))


def most_common(s):
	return ''.join(sorted(s, key=lambda i: -s.count(i)))


from collections import Counter

def most_common(s):
	count = Counter(s)
	return ''.join((t[2] for t in sorted(((-count[c], i, c) for (i, c) in enumerate(s)))))


def most_common(s):
	T = sorted(s, key=lambda x: -s.count(x))
	return ''.join(T)


def most_common(a):
	return ''.join(sorted(a, key=a.count, reverse=True))


most_common = lambda s: ''.join((''.join((x[2] for x in y)) for (_, y) in __import__('itertools').groupby(sorted(((-s.count(x), i, x) for (i, x) in enumerate(s))), lambda x: x[0])))