C++ | Intuitive | Brute | Accepted
\n# Code\n\nclass Solution {\npublic:\n    string findTheString(vector<vector<int>>& lcp) {\n        int n=lcp.size();\n        \n        for(int i=0;i<n;i++){\
\n# Code\n```\nclass Solution {\npublic:\n    string findTheString(vector<vector<int>>& lcp) {\n        int n=lcp.size();\n        \n        for(int i=0;i<n;i++){\n            for(int j=i;j<n;j++){\n                if(i==j){\n                    if(lcp[i][j] != n-i) return "";\n                }\n                else if(lcp[i][j] > n-j) return "";\n                else if(lcp[i][j] != lcp[j][i]) return "";\n            }\n        }\n        \n        string s(n,\'a\');\n        for(int i=0;i<n;i++){\n            for(int j=i+1;j<n;j++){\n                if(lcp[i][j]==0 && s[i]==s[j]){\n                    if(s[j]==\'z\') return "";\n                    else s[j]++;\n                }\n            }\n        }\n\n        for(int i=0;i<n;i++){\n            for(int j=i+1;j<n;j++){\n                int f=i,y=j;\n                bool fg=0;\n                while(lcp[i][j]!=0){\n                    if(s[f]!=s[y]) fg=1;\n                    lcp[i][j]--,f++,y++;\n                }\n                if(f<n && y<n && s[f]==s[y]) return "";\n                if(fg) return "";\n                \n            }\n        }\n        return s;\n        \n    }\n};\n```
['C++']