Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def common(arr):
- L1 = []
- for i in range(len(arr)-1):
- str1 = arr[i]
- for j in str1:
- str2 = arr[i+1]
- if str2.find(j) >= 0:
- if j not in L1:
- L1.append(j)
- i = 0
- found = True
- while i < len(L1):
- j = 0
- while j < len(arr):
- if (arr[j].find(L1[i])) < 0:
- found = False
- break
- elif (arr[j].find(L1[i])) >= 0:
- found = True
- j += 1
- if not found:
- L1.pop(i)
- i = 0
- else:
- i += 1
- found = True
- continue
- return len(L1)
- val = common(['abc', 'bac', 'ab'])
- print(val)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement