Common characters

Write the function common() that takes two strings s1 and s2, and returns another string with those characters that are both in s1 and s2. In the returned string, characters must appear in the same order than in the first given string s1 and there must not be repeated characters. Save this function into the file common.py. Examples:

>>> common('strawberry', 'banana')
'ab'
>>> common('banana', 'strawberry')
'ba'
>>> common('orange', 'lemmon')
'one'
>>> common('potato', 'juice')
''
>>> common('banana', 'ananas')
'an'

Note

More tests are provided in file common.txt

Solution

A solution is provided in file common.py