class Solution:
def findDuplicate(self, paths: List[str]) -> List[List[str]]:
filepaths = {}
for p in paths:
spl = p.split(' ')
directory = spl[0]
for f in spl[1:]:
name = f[:f.index('(')]
content = f[f.index('(')+1:f.index(')')]
if content not in filepaths:
filepaths[content] = []
filepaths[content].append("%s/%s" % (directory, name))
ans = []
for group in filepaths.values():
if len(group) > 1:
ans.append(group)
return ans