擅长:python、mysql、java
<pre><code>def replace(s, position, character):
return s[:position] + character + s[position+1:]
def mask(a,b):
indexb=0
for indexa in range(0,len(a)):
ch=a[indexa]
if (ch.lower()==b[indexb]):
a=replace(a,indexa,'*')
indexb=indexb+1
if (indexb==len(b)):
indexb=0
return a
print(mask("How are you doing today", "hardod"))
</code></pre>
<p>给予</p>
<pre><code>*ow **e you **ing to*ay
</code></pre>