H2573-Talse-C++
\n# Code\n\nclass Solution {\npublic:\n    string findTheString(vector<vector<int>>& lcp) {\n        int n = lcp.size();\n        int c = 0;\n        vector<int
\n# Code\n```\nclass Solution {\npublic:\n    string findTheString(vector<vector<int>>& lcp) {\n        int n = lcp.size();\n        int c = 0;\n        vector<int> letter(n);\n        for (int i = 0; i < n; ++i) {\n            if (letter[i]) continue;\n            if (++c > 26) return "";\n            for (int j = i; j < n; ++j) {\n                if (lcp[i][j] > 0) {\n                    letter[j] = c;\n                }\n            }\n        }\n\n        for (int i = 0; i < n; ++i) {\n            for (int j = 0; j < n; ++j) {\n                int v = 0;\n                if (i+1 < n && j+1 < n) {\n                    v = lcp[i+1][j+1];\n                }\n                if (letter[i] == letter[j]) {\n                    v += 1;\n                } else {\n                    v = 0;\n                }\n                if (lcp[i][j] != v) return "";\n            }\n        }\n\n        string rst = "";\n        for (int c : letter) {\n            rst += \'a\' + c - 1;\n        }\n        return rst;\n    }\n};\n```
['C++']