topic description
there are 10 characters, and each string is 100 characters long. Please write a program in any language to find the longest string that all 10 strings contain.
there are 10 characters, and each string is 100 characters long. Please write a program in any language to find the longest string that all 10 strings contain.
Peking University has a topic. Except that the data are basically the same, you can take a look at http://poj.org/problem?id=3080
. title means to input no more than ten strings, each with a length of no more than 60, and then find out the longest common substring. If there are several substrings of the same length, output the smallest one in dictionary order. If the length of the common substring is less than 3, it will not output (because it is DNA)
you can modify
str_1 = "1234567890"
str_2 = "1235486332"
str_3 = "1234567890"
str_4 = "1234567890"
str_5 = "1234567890"
str_6 = "1234567890"
str_7 = "1234567890"
str_8 = "1234567890"
str_9 = "1234567890"
str_10 = "1234567890"
res = []
daiding = set()
for i in range(10):
str_1_1 = str_1[i]
str_2_1 = str_2[i]
str_3_1 = str_3[i]
str_4_1 = str_4[i]
str_5_1 = str_5[i]
str_6_1 = str_6[i]
str_7_1 = str_7[i]
str_8_1 = str_8[i]
str_9_1 = str_9[i]
str_10_1 = str_10[i]
daiding.add(str_1_1)
daiding.add(str_2_1)
daiding.add(str_3_1)
daiding.add(str_4_1)
daiding.add(str_5_1)
daiding.add(str_6_1)
daiding.add(str_7_1)
daiding.add(str_8_1)
daiding.add(str_9_1)
daiding.add(str_10_1)
if daiding.__len__() ==1:
res.append(str_1_1)
daiding.clear()
print(res)
Previous: Centos 64bit vim font problem
Next: How is the value of the date component of antd preprocessed and passed to the server?
topic description enter an array and a number to determine whether the sum of three numbers in the array is equal to this number ...