class Solution:
    def longestCommonPrefix(self , strs ):
        # write code here
        length = len(strs)
        if strs == '' or (length == 0):
            return ""
        pre = strs[0]
        i = 1
        while (i < len(strs)):
            while(strs[i].find(pre) == -1):
                pre = pre[0:len(pre)-1]
            i=i+1
        return pre