第26187题
以下Python代码实现敏感词替换为保留首字符其余为*,横线处应填写的内容是?

需要将文本中的敏感词替换为保留首字符并用 号覆盖剩余字符。例如:"密码"(2字)替换为"密","身份证"(3字)替换为"身**"。请填写横线处的代码。

words = ["密码", "账号", "身份证"]
text = "请勿泄露您的密码和身份证号码"
for word in words:
    if word in text:
        text = text.replace(word, ________)
print(text) # 期望输出"请勿泄露您的密*和身**号码"
A

word[0] + '' (len(word) - 1)

B

word[0] + '**'

C

'' len(word)

D

word[0] + '' len(word)