/**
  * 
  * @param strs string字符串一维数组 
  * @return string字符串
  */
function longestCommonPrefix( strs ) {
    // write code here
    if(!strs.length) return ""
    let res = ""
    let falg = true
    for(let i = 0; i<strs[0].length; i++) {
        const str = strs[0][i]
        for(let j =1; j<strs.length; j++) {
            if(strs[j][i] != str) {
                falg = false
                break;
            } else {
                falg = true
            }
        }
        if(falg) res += str
    } 
    return res
}
module.exports = {
    longestCommonPrefix : longestCommonPrefix
};