Answer:
Step-by-step explanation:
The following code is written in Python, the function creates various nested loops to loop through each individual string comparing letter by letter in order to find the longest common substring. Finally, returning the substring itself.
def shared_motif(dna_list):
substr = ''
if len(dna_list) > 1 and len(dna_list[0]) > 0:
for x in range(len(dna_list[0])):
for i in range(len(dna_list[0]) - x + 1):
if i > len(substr) and all(dna_list[0][x:x + i] in y for y in dna_list):
substr = dna_list[0][x:x + i]
return substr
arr = ["GATTACA", "TAGACCA", "ATACA"]
stems = shared_motif(arr)
print(stems)