题目:
考察内容:
str.repalce(old, new, 1); flag
代码:
python
"""
题目分析:
没有掌握,输出为0
输入:
words的个数, N int
每个字符串元素
输出:
词汇表words中掌握的单词个数
4
cat
bt
hat
tree
atach??
4
ax
cae
hcae
ahe
atach?
1
tree
atach??
思路:
"""
N = int(input())
words_list = list()
words_set = set()
for _ in range(N):
str_temp = input()
words_list.append(str_temp)
glossary = input()
# 先把替换的字母求出来,再遍历,去重
res_sum = 0
for words in words_list:
# 每遍历一个新的word, 词汇表重新赋值
temp_glossary = glossary
flag = False
for word in words:
if word in temp_glossary:
temp_glossary = temp_glossary.replace(word, "", 1)
elif "?" in temp_glossary:
temp_glossary = temp_glossary.replace("?", "", 1)
else:
flag = True
if not flag:
res_sum += 1
print(res_sum)