Given two strings of lowercase letters, a and b, print the longest string x of lowercase letters such that there is a permutation of x that is a subsequence of a and there is a permutation of x that is a subsequence of b.
Solution: That’s short and nice problem. You have to find all letters which are in both strings. I’d actually like to see some other implementations of this. I bet there are some languages which handle this in a smart way.
def intersection(lst1, lst2):
same = 
if len(lst1) > len(lst2):
for k in lst1:
try: # checks if element k is in lst2
for k in lst2:
inp1 = raw_input()
inp2 = raw_input()
common = intersection(list(inp1), list(inp2))