def solution(words: list) -> str:
b_list = ["#" for x in range(len(words[0]))]
for text_word in words:
for i in range(len(words[0])):
if text_word[i] != "*":
b_list[i] = text_word[i]
else:
continue
str_word = "".join(x for x in b_list)
return str_word
assert solution(["a*cde", "*bcde", "*bcde"]) == "abcde"
assert solution(["a*c**", "**cd*", "a*cd*"]) == "a#cd#"
assert solution(["******", "******", "******", "******"]) == "######"
def solution(words: list) -> str:
# your code here
m = ["#" for x in range(len(words[0]))]
for i in range(0, len(words)):
for j, h in enumerate(words[i]):
if m[j] == '*'or m[j] == '#':
if h == '*':m[j] = '#'
else:m[j] = h
return ''.join(i for i in m)
def solution(words: list) -> str:
# your code here
list_word = ["#" for o in range(len(words[0]))]
for i in words:
for j in range(len(i)):
if i[j] != "*":
list_word[j] = i[j]
words_str = "".join(list_word)
return words_str
assert solution(["a*cde", "*bcde", "*bcde"]) == "abcde"
assert solution(["a*c**", "**cd*", "a*cd*"]) == "a#cd#"
assert solution(["******", "******", "******", "******"]) == "######"
def solution(words: list) -> str:
res = ["#" for x in range(len(words[0]))]
for word in words:
for i in range(len(res)):
if word[i] != '*':
res[i] = word[i]
res = ''.join(i for i in res)
print(res)
return res
assert solution(["a*cde", "*bcde", "*bcde"]) == "abcde"
assert solution(["a*c**", "**cd*", "a*cd*"]) == "a#cd#"
assert solution(["******", "******", "******", "******"]) == "######"
def solution(words: list) -> str:
words_list = []
for i in range(len(words[0])):
for j in range(len(words)):
if words[j][i] != '*':
words_list.append(words[j][i])
break
if words[len(words)-1][i] == '*':
words_list.append('#')
break
return ''.join(words_list)
import re
def solution(words):
if words == []:
return ''
else:
indexs = [i.start() for i in re.finditer('\*', words[0])]
datas = [x for x in words[0]]
for i in range(1, len(words)):
for ind in indexs:
if words[i][ind] != '*':
datas[ind] = words[i][ind]
_datas = ''.join(datas)
return re.sub('\*','#', _datas)
def solution(words: list)->str :
list_result = ['#' for i in range(len(words[0]))]
for i in words:
for j in range(len(i)):
if i[j]!='*':
list_result[j]=i[j]
return ''.join(list_result)
def get_work(words: list) -> str:
# 找出单词中包含*最少的单词;
my_dict = {}
for i in words:
my_dict[i.count("*")] = i
new_list = sorted(my_dict.items(), key=lambda x: x[0])
new_word = [i[1] for i in new_list]
word_str = list(new_word[0])
j = 0
max_ = 0
for i in new_word[0]:
if i == "*":
for a in words:
if a[j] != "*":
word_str[j] = a[j]
max_ += 1
if max_ == new_word[0].count("*"):
return "".join(word_str)
j += 1
word_str = "".join(word_str)
return word_str.replace("*", "#")
def solution(words: list) -> str:
word = list(words[0])
for i in words:
for j in range(len(i)):
if i[j] != '*':
word[j] = i[j]
for i in range(len(word)):
if word[i] == "*":
word[i] = '#'
return ''.join(word)
def solution(words: list) -> str:
# your code here
entire_word=[]
for i in range(len(words[0])):
for j in words:
if j[i] != '*':
entire_word.append(j[i])
break
else:
entire_word.append('#')
return ''.join(entire_word)
def solution(words: list) -> str:
new_word = ''
for item in zip(*words):
for i in range(len(item)):
if item[i] != '*':
new_word += item[i]
break
else:
new_word += '#'
return new_word
def solution(words: list) -> str:
result = ""
for idx in range(len(words[0])):
for i, word in enumerate(words):
if word[idx] != "*":
result += word[idx]
break
if i == len(words) - 1:
result += "#"
return result
assert solution(["a*cde", "*bcde", "*bcde"]) == "abcde"
assert solution(["a*c**", "**cd*", "a*cd*"]) == "a#cd#"
assert solution(["******", "******", "******", "******"]) == "######"
def solution(words: list) → str:
arr = [‘#’ for i in range(len(words[0]))]
for word in words:
for i in range(len(word)):
if ‘#’ not in arr:
return ‘’.join(arr)
if word[i] != ‘*’ and arr[i] == ‘#’:
arr[i] = word[i]
return ‘’.join(arr)
def solution(words: list) -> str:
res_list=[a for a in len(words[0])*'*']
for i in range(len(words)):
for j in range(len(words[i])):
if words[i][j].islower():
res_list.pop(j)
res_list.insert(j,words[i][j])
else:
if not res_list[j].islower():
res_list.pop(j)
res_list.insert(j,'#')
return ''.join(res_list)
assert solution(["a*cde", "*bcde", "*bcde"]) == "abcde"
assert solution(["a*c**", "**cd*", "a*cd*"]) == "a#cd#"
assert solution(["******", "******", "******", "******"]) == "######"