Complete the  function `scramble(str1, str2)` that returns `true` if a portion of ```str1``` characters can be rearranged to match ```str2```, otherwise returns ```false```.

**Notes:**
* Only lower case letters will be used (a-z). No punctuation or digits will be included.
* Performance needs to be considered

## Examples

```python
scramble('rkqodlw', 'world') ==> True
scramble('cedewaraaossoqqyt', 'codewars') ==> True
scramble('katas', 'steak') ==> False
```

Source: codewars | Difficulty: EASY
Tags: String algorithms

Starter code: def scramble(s1, s2):
	

Solutions:
def scramble(s1, s2):
	for c in set(s2):
		if s1.count(c) < s2.count(c):
			return False
	return True


from collections import Counter

def scramble(s1, s2):
	return len(Counter(s2) - Counter(s1)) == 0


def scramble(s1, s2):
	return not any((s1.count(char) < s2.count(char) for char in set(s2)))


def scramble(s1, s2):
	return all((s1.count(x) >= s2.count(x) for x in set(s2)))


def scramble(s1, s2):
	dct = {}
	for l in s1:
		if l not in dct:
			dct[l] = 1
		else:
			dct[l] += 1
	for l in s2:
		if l not in dct or dct[l] < 1:
			return False
		else:
			dct[l] -= 1
	return True


from collections import Counter

def scramble(s1, s2):
	c1 = Counter(s1)
	c2 = Counter(s2)
	return not (c2 - c1).values()


from collections import Counter
from operator import sub

def scramble(s1, s2):
	return not sub(*map(Counter, (s2, s1)))


from collections import Counter

def scramble(s1, s2):
	return not Counter(s2) - Counter(s1)


def scramble(s1, s2):
	return all([s1.count(l2) >= s2.count(l2) for l2 in set(s2)])


def scramble(s1, s2):
	return all((s1.count(i) >= s2.count(i) for i in set(s2)))


from collections import Counter
scramble = lambda s1, s2: not Counter(s2) - Counter(s1)


scramble = lambda a, b, c=__import__('collections').Counter: not c(b) - c(a)


def scramble(s1, s2):
	return not False in [s1.count(i) >= s2.count(i) for i in set(s2)]


def scramble(s1, s2):
	a = 'abcdefghijklmnopqrstuvwxyz'
	b = []
	for char in a:
		if s1.count(char) >= s2.count(char):
			b.append(True)
		else:
			b.append(False)
	if len(set(b)) <= 1:
		return True
	else:
		return False


def scramble(s1, s2):
	str1 = {}
	str2 = {}
	for s in s1:
		try:
			str1[s] = str1[s] + 1
		except KeyError:
			str1[s] = 1
	for s in s2:
		try:
			str2[s] = str2[s] + 1
		except KeyError:
			str2[s] = 1
	for key in str2:
		try:
			if str1[key] < str2[key]:
				return False
		except KeyError:
			return False
	return True


def scramble(s1, s2):
	cts = [s2.count(i) for i in list(set(s2))]
	dic = dict(zip(list(set(s2)), cts))
	truth = True
	for char in list(s1):
		try:
			if dic[char] > 0:
				dic[char] = dic[char] - 1
		except KeyError:
			pass
	if sum(dic.values()) > 0:
		truth = False
	return truth


def scramble(s1, s2):
	stacks = {}
	for char in s2:
		if char in stacks:
			stacks[char] += 1
		else:
			stacks[char] = 1
	for char in s1:
		if char in stacks:
			stacks[char] -= 1
	return max(stacks.values()) <= 0


from collections import Counter as c

def scramble(s1, s2):
	s1 = c(s1)
	s2 = c(s2)
	for i in s2:
		if s1[i] < s2[i]:
			return False
	return True


from collections import defaultdict
import gc

def scramble(s1, s2):
	a = defaultdict(lambda : False)
	for item in s2:
		a[item] = a.get(item, 0) + 1
	b = defaultdict(lambda : False)
	for item in s1:
		b[item] = b.get(item, 0) + 1
	try:
		for item in a:
			if b[item] and a[item] <= int(b[item]):
				pass
			else:
				return False
		return True
	finally:
		del a, b, s1, s2
		gc.collect()


def scramble(s1, s2):

	def is_subsequence(needle, haystack):
		it = iter(haystack)
		return all((c in it for c in needle))
	return is_subsequence(sorted(s2), sorted(s1))


def scramble(s1, s2):
	for i in 'abcdefghijklmnopqrstuvwxyz':
		if s1.count(i) < s2.count(i):
			return False
	return True


def scramble(s1, s2):
	return all([s2.count(c) <= s1.count(c) for c in set(s2)])


def scramble(s1, s2):
	it = iter(sorted(s1))
	return all((c in it for c in sorted(s2)))


def scramble(s1, s2):
	for letter in 'abcdefghijklmnopqrstuwvxyz':
		if s1.count(letter) < s2.count(letter):
			return False
	return True


class scramble(zip):

	def __eq__(self, other):
		return True


def scramble(str, wrd):
	w = set(wrd)
	for i in w:
		if str.count(i) < wrd.count(i):
			return False
	return True


from collections import Counter

def scramble(s1, s2):
	dict = Counter(s1)
	dict1 = Counter(s2)
	for k in dict1.keys():
		if not k in dict.keys():
			return False
		if dict1[k] > dict[k]:
			return False
	return True


from collections import Counter

def scramble(s1, s2):
	se1 = Counter(s1)
	se2 = Counter(s2)
	return se1 | se2 == se1


from collections import Counter

def scramble(s1, s2):
	return True if len(Counter(s2) - Counter(s1)) == 0 else False


def scramble(s1, s2):

	def ccount(s):
		d = {}
		for c in s:
			d[c] = d.get(c, 0) + 1
		return d
	d1 = ccount(s1)
	for (c, count) in list(ccount(s2).items()):
		if d1.get(c, 0) < count:
			return False
	return True


from collections import deque

def scramble(s1, s2):
	s1 = deque(sorted(s1))
	s2 = sorted(s2)
	for letter in s2:
		if len(s1) == 0:
			return False
		while len(s1):
			next_letter = s1.popleft()
			if next_letter == letter:
				break
			if next_letter > letter:
				return False
	return True


scramble = lambda s1, s2: len([x for x in [(char, s2.count(char), s1.count(char)) for char in set(s2)] if x[2] < x[1]]) == 0


def scramble(s1, s2):
	l = []
	for x in s2:
		if x not in l:
			if s1.count(x) < s2.count(x):
				return False
			l.append(x)
	return True


from collections import Counter

def scramble(s1, s2):
	if not set(s2).issubset(set(s1)):
		return False
	s1_counts = Counter(s1)
	s2_counts = Counter(s2)
	s1_counts.subtract(s2_counts)
	return not any([x for x in list(s1_counts.items()) if x[1] < 0])


def scramble(s1, s2):
	a = [s1.count(chr(i)) - s2.count(chr(i)) for i in range(97, 123)]
	for i in a:
		if i < 0:
			return False
	return True


from collections import Counter

def scramble(s1, s2):
	a = Counter(s1)
	b = Counter(s2)
	a.subtract(b)
	new = []
	for i in a:
		if a[i] >= 0:
			new.append(i)
	return len(new) == len(a)


from collections import Counter

def scramble(s1, s2):
	a = Counter(s1)
	b = Counter(s2)
	for (k, v) in b.items():
		if k not in a.keys() or a[k] < v:
			return False
	return True


def scramble(s1, s2):
	(d1, d2) = ({}, {})
	for i in s1:
		if i not in d1:
			d1[i] = 1
		else:
			d1[i] += 1
	for i in s2:
		if i not in d2:
			d2[i] = 1
		else:
			d2[i] += 1
	for key in list(d2.keys()):
		if not key in list(d1.keys()) or d1[key] < d2[key]:
			return False
	return True


def scramble(s1, s2):
	s1_count = dict.fromkeys(set(s1), 0)
	for i in s1:
		s1_count[i] += 1
	try:
		for i in s2:
			s1_count[i] -= 1
	except:
		return False
	return all((i >= 0 for i in s1_count.values()))


def scramble(s1, s2):
	s1_dict = {}
	for i in s1:
		if i in s1_dict:
			s1_dict[i] += 1
		else:
			s1_dict[i] = 1
	s2_dict = {}
	for i in s2:
		if i in s2_dict:
			s2_dict[i] += 1
		else:
			s2_dict[i] = 1
	for (k, v) in s2_dict.items():
		if k not in s1_dict or s1_dict[k] < v:
			return False
	return True


from collections import Counter

def scramble(s1, s2):
	c1 = Counter(s1)
	c2 = Counter(s2)
	c1.subtract(c2)
	c3 = [v < 0 for (k, v) in c1.items() if k in c2.keys()]
	return not any(c3)


from collections import Counter

def scramble(s1, s2):
	if set(s1) < set(s2):
		return False
	cnt1 = Counter(s1)
	cnt2 = Counter(s2)
	cnt1.subtract(cnt2)
	notOk = [x < 0 for x in list(cnt1.values())]
	return not any(notOk)


def scramble(s1, s2):
	if len(s2) > len(s1):
		return False
	let1 = [s1.count(chr(i)) for i in range(97, 123)]
	let2 = [s2.count(chr(i)) for i in range(97, 123)]
	sub = [True if let1[i] >= let2[i] else False for i in range(26)]
	return True if False not in sub else False


import string
alphabet = {key: idx for (idx, key) in enumerate(string.ascii_lowercase)}

def scramble(s1, s2):
	used_words1 = [0] * 26
	used_words2 = [0] * 26
	for element in s1:
		used_words1[alphabet[element]] += 1
	for element in s2:
		used_words2[alphabet[element]] += 1
	for i in range(26):
		if used_words2[i] > used_words1[i]:
			return False
	return True


def scramble(s1, s2):
	while len(s2) > 0:
		if s1.count(s2[0]) < s2.count(s2[0]):
			return False
		else:
			s2 = s2.replace(s2[0], '')
	return True


def scramble(s1, s2):
	clean = ''
	boolean = []
	for i in s2:
		if i not in clean:
			clean = clean + i
	for i in clean:
		if s2.count(i) > s1.count(i):
			return False
	return True


def scramble(s1, s2):
	for letter in 'abcdefghijklmnopqrstuvwxyz':
		if s2.count(letter) <= s1.count(letter):
			continue
		else:
			return False
	return True


from collections import Counter

def scramble(s1, s2):
	count_letters = Counter(s1)
	count_letters.subtract(Counter(s2))
	return all((n >= 0 for n in count_letters.values()))


def scramble(s1, s2):
	s1_dict = dict()
	for char in s1:
		if char in s1_dict:
			s1_dict[char] = s1_dict[char] + 1
		else:
			s1_dict[char] = 1
	for char in s2:
		if char not in s1_dict or s1_dict[char] == 0:
			return False
		else:
			s1_dict[char] = s1_dict[char] - 1
	return True


def scramble(s1, s2):
	if len(s1) < len(s2):
		return False
	s1_dict = {}
	s2_dict = {}
	for char in s1:
		try:
			s1_dict[char] += 1
		except KeyError:
			s1_dict[char] = 1
	for char in s2:
		try:
			s2_dict[char] += 1
		except KeyError:
			s2_dict[char] = 1
	for key in s2_dict:
		try:
			if s1_dict[key] < s2_dict[key]:
				return False
		except KeyError:
			return False
	return True


def scramble(s1, s2):
	return all((s1.count(l) - s2.count(l) >= 0 for l in set(s2)))


def scramble(s1, s2):
	s1ct = {}
	for ltr in s1:
		if ltr in s1ct.keys():
			s1ct[ltr] += 1
		else:
			s1ct[ltr] = 1
	s2ct = {}
	for ltr in s2:
		if ltr in s2ct.keys():
			s2ct[ltr] += 1
		else:
			s2ct[ltr] = 1
	for ltr in s2ct.keys():
		if ltr not in s1ct.keys():
			return False
		if s2ct[ltr] > s1ct[ltr]:
			return False
	return True


from collections import Counter

def scramble(s1, s2):
	s1 = Counter(s1)
	s2 = Counter(s2)
	return len([c for c in s2 if s1[c] >= s2[c]]) == len(s2.keys())


from collections import Counter

def scramble(s1, s2):
	one_split = list(s1)
	two_split = list(s2)
	count = 0
	copy = two_split[:]
	one = Counter(one_split)
	two = Counter(two_split)
	for x in two_split:
		if x not in list(two.keys()):
			return False
		if one[x] < two[x]:
			return False
	return True


def scramble(s1, s2):
	s1 = list(s1)
	s2 = list(s2)
	s1.sort()
	s2.sort()
	len1 = len(s1)
	len2 = len(s2)
	i = 0
	j = 0
	while i < len1 and j < len2:
		if len1 - i < len2 - j:
			return False
		if s1[i] == s2[j]:
			i += 1
			j += 1
		elif s1[i] != s2[j]:
			i += 1
	if j == len(s2):
		return True
	return False


def scramble(s1, s2):
	(j, k) = (1, 1)
	a = {chr(i): 0 for i in range(97, 123)}
	b = {chr(i): 0 for i in range(97, 123)}
	for i in s1:
		if i not in a:
			continue
		else:
			a[i] = a[i] + 1
	for n in s2:
		if n not in b:
			continue
		else:
			b[n] = b[n] + 1
	for i in s2:
		if a[i] >= b[i]:
			pass
		else:
			return False
	return True


from collections import Counter as count

def scramble(s1, s2):
	return len(count(s2) - count(s1)) == 0


def scramble(s1, s2):
	Mot = ''.join(dict.fromkeys(s2))
	for i in range(len(Mot)):
		if s1.count(Mot[i]) < s2.count(Mot[i]):
			return False
	return True


from collections import Counter

def scramble(s1, s2):
	return True if sum((Counter(s2) & Counter(s1)).values()) == len(s2) else False


def scramble(s1, s2):
	d1 = {}
	for i in set(s1):
		d1[i] = s1.count(i)
	for i in set(s2):
		try:
			if s2.count(i) > d1[i]:
				return False
		except:
			return False
	return True


def scramble(s1, s2):
	set1 = set(s1)
	set2 = set(s2)
	for letter in set2:
		if letter not in set1:
			return False
		if s1.count(letter) < s2.count(letter):
			return False
	else:
		return True


def scramble(s1, s2):
	import numpy
	options = {}
	for i in s1:
		if i in options:
			options[i] += 1
		else:
			options[i] = 1
	word = {}
	for i in s2:
		if i not in options:
			return False
		if i in word:
			word[i] += 1
		else:
			word[i] = 1
	for i in word:
		if word[i] > options[i]:
			return False
	return True


def scramble(s1, s2):
	s1_counter = [0] * 256
	s2_counter = {}
	for c in s1:
		idx = ord(c)
		s1_counter[idx] += 1
	for c in s2:
		if c in s2_counter:
			s2_counter[c] += 1
		else:
			s2_counter[c] = 1
	for (key, value) in s2_counter.items():
		idx = ord(key)
		if s1_counter[idx] < value:
			return False
	return True


def scramble(s1, s2):
	s = list(set(s2))
	for i in s:
		if s1.count(i) < s2.count(i):
			return False
	return True


def scramble(s1, s2):
	char_count_s1 = {c: s1.count(c) for c in set(s1)}
	char_count_s2 = {c: s2.count(c) for c in set(s2)}
	for c in char_count_s2:
		if c not in char_count_s1:
			return False
		elif char_count_s1[c] < char_count_s2[c]:
			return False
	return True


def scramble(s1, s2):
	for l in set(s2):
		if l not in s1 or s1.count(l) < s2.count(l):
			return False
	return True


from collections import Counter

def scramble(s1, s2):
	for c in set(s2):
		if s2.count(c) <= s1.count(c):
			continue
		else:
			return False
	return True


scramble = lambda s, t: (lambda c, d: all((c.get(o, 0) >= d[o] for o in t)))({i: s.count(i) for i in set(s)}, {i: t.count(i) for i in set(t)})


def scramble(s1, s2):
	counter01 = [0] * 26
	counter02 = [0] * 26
	for char in s1:
		counter01[ord(char) - 97] += 1
	for char in s2:
		counter02[ord(char) - 97] += 1
	for i in range(26):
		if counter01[i] < counter02[i]:
			return False
	return True


def scramble(s1, s2):
	s2_dict = {}
	for c in set(s2):
		s2_dict[c] = s2.count(c)
	output = True
	for c in sorted(s2_dict, key=s2_dict.get, reverse=True):
		s2_count = s2_dict[c]
		if s2_count > s1.count(c):
			output = False
			break
	return output


def scramble(s1, s2):
	s1_dict = dict()
	s2_dict = dict()
	s2_set = set(s2)
	for c in s2_set:
		s2_dict[c] = s2.count(c)
		s1_dict[c] = s1.count(c)
	for c in s2_set:
		if c not in s1_dict or s2_dict[c] > s1_dict[c]:
			return False
	return True


def scramble(s1, s2):
	c = {item: s1.count(item) for item in set(s1)}
	d = {item: s2.count(item) for item in set(s2)}
	for item in d:
		e = c.get(item) or None
		if not e or e < d.get(item):
			return False
	return True


def scramble(s1, s2):
	dict_s1 = {}
	for char in s1:
		dict_s1[char] = dict_s1[char] + 1 if char in dict_s1.keys() else 1
	for char in set(s2):
		if not char in dict_s1.keys():
			return False
		if s2.count(char) > dict_s1[char]:
			return False
		dict_s1[char] -= s2.count(char)
	return True


from collections import Counter

def scramble(s1, s2):
	d1 = dict(Counter(s1))
	d2 = dict(Counter(s2))
	d3 = {k: v for (k, v) in d1.items() if k in d2.keys()}
	missing = {k: v for (k, v) in d2.items() if k not in d3}
	if len(missing) >= 1:
		return False
	elif len(s2) == 0 or len(s1) == 0:
		return False
	elif len(missing) == 0:
		calc = {k: d3[k] - d2[k] for k in d2.keys() & d3}
		return True if all((value >= 0 for value in calc.values())) else False


def scramble(s1, s2):
	list_chr = tuple(set(s2))
	for i in list_chr:
		if s1.count(i) < s2.count(i):
			return False
	return True


def scramble(s1, s2):
	fr = set(s1)
	sc = set(s2)
	for i in sc:
		if i not in fr:
			return False
		elif i in fr:
			if s1.count(i) < s2.count(i):
				return False
	return True


def scramble(s1, s2):
	if None in (s1, s2):
		return False
	passed = []
	for letter in s2:
		if letter in passed:
			continue
		if letter not in s1 or s2.count(letter) > s1.count(letter):
			return False
		passed.append(letter)
	else:
		return True


from collections import Counter

def scramble(s1, s2):
	t1 = Counter(s1)
	t2 = Counter(s2)
	d = t2 - t1
	return len(d) == 0


def scramble(string_to_rearrange, string_to_match):
	letters_in_string_to_match = {}
	for letter in string_to_match:
		if letter not in letters_in_string_to_match:
			letters_in_string_to_match[letter] = string_to_match.count(letter)
	letters_in_string_to_rearrange = {}
	for letter in string_to_rearrange:
		if letter not in letters_in_string_to_rearrange:
			letters_in_string_to_rearrange[letter] = string_to_rearrange.count(letter)
	for letter in letters_in_string_to_match:
		try:
			if letters_in_string_to_match[letter] > letters_in_string_to_rearrange[letter]:
				return False
		except KeyError:
			return False
	return True


from collections import Counter

def scramble(s1, s2):
	l = Counter(s1)
	w = Counter(s2)
	diff = w - l
	return len(diff) == 0


def scramble(s1, s2):
	unique_letters = list(set(s2))
	count_letters = [s2.count(x) for x in unique_letters]
	return not False in [s1.count(x) >= count_letters[i] for (i, x) in enumerate(unique_letters)]


def scramble(s1, s2):
	for el in set(s2):
		if not s1.count(el) >= s2.count(el):
			return False
	return True


def scramble(s1, s2):
	list = []
	for letter in s2:
		if letter in list:
			continue
		else:
			list.append(letter)
		if s2.count(letter) <= s1.count(letter):
			pass
		else:
			return False
	return True


def scramble(str1, str2):
	if len(str1) < len(str2):
		return False
	str1 = ''.join(sorted(str1))
	str2 = ''.join(sorted(str2))
	i = 0
	while i < len(str2):
		N = str2.count(str2[i])
		if str1.count(str2[i]) < N:
			return False
		i += N
	return True


def scramble(s1, s2):
	a1 = 26 * [0]
	for c in s1:
		a1[ord(c) - 97] += 1
	for c in s2:
		a1[ord(c) - 97] -= 1
		if a1[ord(c) - 97] < 0:
			return False
	return True


def scramble(s1, s2):
	from collections import Counter
	c1 = Counter(s1)
	c2 = Counter(s2)
	for (key, val) in c2.items():
		if key not in c1.keys():
			return False
		elif val > c1[key]:
			return False
	return True


def map_char_count(s):
	char_count = {}
	for c in s:
		if c in char_count:
			char_count[c] += 1
		else:
			char_count[c] = 1
	return char_count

def scramble(s1, s2):
	s1_count = map_char_count(s1)
	s2_count = map_char_count(s2)
	for (k, v) in list(s2_count.items()):
		if k not in s1_count or s1_count[k] < v:
			return False
	return True


def scramble(s1, s2):
	for char in list(set(list(s2))):
		if char not in s1:
			return False
		if s2.count(char) > s1.count(char):
			return False
	return True


def scramble(s1, s2):
	(st1, st2) = (set(s1), set(s2))
	if not st2.issubset(st1):
		return False
	elif not all(map(lambda char: s1.count(char) >= s2.count(char), st2)):
		return False
	else:
		return True


def scramble(s1, s2):
	seen = []
	for letter in s2:
		if letter not in s1:
			return False
	for letter in s2:
		if letter in seen:
			continue
		if s1.count(letter) < s2.count(letter):
			return False
		else:
			seen.append(letter)
	return True


from collections import Counter

def scramble(s1, s2):
	(s1_count, s2_count) = (Counter(s1), Counter(s2))
	return all((s1_count[letter] >= s2_count[letter] for letter in s2))


def scramble(s1, s2):
	d1 = {}
	for ch in s1:
		if ch not in d1:
			d1[ch] = 1
		else:
			d1[ch] = d1[ch] + 1
	for ch in s2:
		try:
			if d1[ch] == 0:
				return False
		except KeyError:
			return False
		else:
			d1[ch] = d1[ch] - 1
	return True


from collections import Counter

def scramble(s1, s2):
	(d1, d2) = (Counter(s1), Counter(s2))
	for (k, v) in list(d2.items()):
		if v > d1[k]:
			return False
	return True