class Solution:
def longestCommonPrefix(self, strs):
"""
:type strs: List[str]
:rtype: str
"""
if len(strs)==0:
return ''
x=0
y=0
while x<len(strs) and y<len(strs[x]):
if x==0:
word=strs[x][y]
else:
if strs[x][y]!=word:
break
if x==len(strs)-1:
y+=1
x=0
else:
x+=1
return strs[x][:y]