def commonprefix(m):
 if (not m):
  return ''
 s1 = min(m)
 s2 = max(m)
 n = min(len(s1), len(s2))
 for i in xrange(n):
  if (s1[i] != s2[i]):
   return s1[:i]
 return s1[:n]

def commonprefix ( m ) : if ( not m ) : return '' s1 = min ( m ) s2 = max ( m ) n = min ( len ( s1 ) , len ( s2 ) ) for i in xrange ( n ) : if ( s1 [ i ] != s2 [ i ] ) : return s1 [ : i ] return s1 [ : n ]
given a list of pathnames .