class Solution {
public:
    /**
     * 
     * @param strs string字符串vector 
     * @return string字符串
     */
    string longestCommonPrefix(vector<string>& strs) {
        int len = strs.size();
        if (len == 0) {
            return "";
        }
        if (len == 1) {
            return strs[0];
        }
        string tempStr = strs[0], ret;
        for (int i = 0; i < tempStr.size(); i++) {
            for (int j = 0; j < len; j++) {
                // 有一个不等的就直接return ret,否则继续++
                if (tempStr[i] != strs[j][i]) {
                    return ret;
                }
            }
            ret += tempStr[i];
        }
        return ret;
    }
};