# Task
 Consider a string of lowercase Latin letters and space characters (" "). 
 
 First, rearrange the letters in each word `alphabetically`. 
 
 And then rearrange the words in ascending order of the sum of their characters' `ASCII` values. 
 
 If two or more words have the same `ASCII` value, rearrange them by their length in ascending order; If their length still equals to each other, rearrange them `alphabetically`.
 
 Finally, return the result.

# Example

 For `s = "batman is bruce wayne"`, the result should be `"is bceru aenwy aamntb"`.
``` 
After rearranging the letters the string turns into
"aamntb is bceru aenwy".
The ASCII values of each word are: [627, 220, 529, 548].
After sorting the words the following string is obtained:
"is bceru aenwy aamntb" (with ASCII values of [220, 529, 548, 627]).```

 For `s = "peter parker is spiderman"`, the result should be `"is eeprt aekprr adeimnprs"`

 `(ASCII values: [220, 554, 645, 963])`

# Input/Output


 - `[input]` string `s`

  A string of lowercase words. Each word is separated by exactly one space character.


 - `[output]` a string

Difficulty: EASY
Starter code: def revamp(s):
	

Solutions:
def revamp(s):
	words = [''.join(sorted(word)) for word in s.split()]
	words.sort(key=lambda word: (sum(map(ord, word)), len(word), word))
	return ' '.join(words)


def revamp(s):
	words = [''.join(sorted(word)) for word in s.split()]
	return ' '.join(sorted(words, key=lambda word: (sum((ord(c) for c in word)), len(word), word)))


revamp = lambda s: ' '.join(sorted(map(lambda x: ''.join(sorted(x)), s.split()), key=lambda w: (sum(map(ord, w)), len(w), w)))


revamp = lambda s: ' '.join(sorted([''.join(sorted(i)) for i in s.split()], key=lambda x: (sum(map(ord, x)), len(x), x)))


def revamp(s):
	return ' '.join(sorted([''.join(sorted(w)) for w in s.split()], key=lambda w: (sum((ord(c) for c in w)), w)))


def revamp(s):
	s = [''.join(sorted(i)) for i in s.split()]
	return ' '.join(sorted(s, key=lambda x: (sum((ord(i) for i in x)), len(x), x)))


def revamp(s):
	words = s.split()
	words = [''.join(sorted(w)) for w in words]
	words = sorted(words, key=lambda w: (sum((ord(i) for i in w)), w))
	return ' '.join(words)


def revamp(s):
	return ' '.join([x for x in sorted((''.join(sorted(x)) for x in s.split()), key=lambda x: (sum(map(ord, x)), x))])