Basically, I want to remove the characters from two strings, as many times as they occur in both. For example if we got two strings "cat","cats", when I print the final result I would have "s". What have I done is the following: I have a function which takes two strings and converts them into two separate lists, which are sorted straight after that. I've got a loop which checks whether the first part of the string is in the second one and then it removes the occurrence, however the problem is that if I use the strings "cat","cast" I would get "st" instead of just "s". I know where the problem is exactly in my code. I believe I have to loop through both of the lists but I can't find a solution.I am using python 3 Thank you for taking your time.
def func1(arg1,arg2)
l1=list(arg1)
l1.sort()
l2=list(arg2)
l2.sort()
for i in l1:
if (l1[0]==l2[0]):
del l2[0]