from collections import defaultdict
def second_string_can_be_formed_from_first_string(first, second):
freqency = defaultdict(int)
for i in range(len(first)):
freqency[first[i]] += 1
for i in range(len(second)):
if freqency[second[i]] == 0:
return False
return True
first = "apyoknthtm"
second = "python"
print(second_string_can_be_formed_from_first_string(first, second))
'''
run:
True
'''