blob: b426840cc6b4e1c15b1642012629ca39c28ea7d9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
arrWords = ["java", "javascript", "julia"] ## Example 1
## arrWords = ["bella", "label", "roller"] ## Example 2
## arrWords = ["cool", "lock", "cook"] ## Example 3
arrUniqChar = list(set([*arrWords[0]]))
arrOutput = []
for charLoop in arrUniqChar:
bExist = True
nNumCount = arrWords[0].count(charLoop)
for wordLoop in arrWords[1:]:
if charLoop in wordLoop:
nNumCount = min(nNumCount, wordLoop.count(charLoop))
else:
bExist = False
break
if bExist:
arrOutput = arrOutput + [charLoop] * nNumCount
print (arrOutput)
|