If I want to write a function mask(a, b) that takes two strings, a and b, and change the letters to * in a in the order they appear in b, returned in a new string.
For example if s1="How are you doing today" and s2="hardod" than the new string/updated s1 string should be "*ow **e you **ing to*ay".
Is there any way to do this?
def mask(a,b):
    for ch in s2:
    
         s1 = s1.replace(ch, '*', 1)
    return s1
print(mask("How are you doing today", "hardod"))
Then I get the output H*ll*, *ow **e you Anders? which is wrong as they should be replaced in turn, ie the first letter in b should replace the same letter in a on the first index it appears on and no more, then b should continue to the second letter ib and replace the same letter ia on the first index on which it appears and no more etc.
 
     
    