fork download
  1. def task(s1,s2):
  2. w1=s1.split(' ')
  3. w2=s2.split(' ')
  4. res=[]
  5. for ww in w1:
  6. if (ww in w2) and (ww != ''):
  7. res+=[ww]
  8. return res
  9.  
  10. print(task("as hd d dd","sd hd aw d ii"))
Success #stdin #stdout 0.02s 9220KB
stdin
Standard input is empty
stdout
['hd', 'd']