Easy to understand
\n\nclass Solution {\npublic:\n    string findTheString(vector<vector<int>>& lcp) {\n        int n=lcp.size();\n        string ans="";\n        for(int i=0;i<n;
\n```\nclass Solution {\npublic:\n    string findTheString(vector<vector<int>>& lcp) {\n        int n=lcp.size();\n        string ans="";\n        for(int i=0;i<n;i++){\n            if(lcp[i][i]!=(n-i)) return "";\n            for(int j=i,k=i;j>=0;j--,k--){\n                if(lcp[i][j]!=lcp[j][i]) return "";\n                if(lcp[i][j]>min(n-i,n-j)) return "";\n            }\n        }\n        ans+=\'a\';\n        int r=1;\n        int z=1;\n        int prev=1;\n        for(int i=1;i<n;i++){\n            for(int j=0;j<i;j++){\n                int cnt=lcp[i][j];\n                if(cnt==0) continue;\n                if(i+1<n && j+1<n){\n                    if(lcp[i+1][j+1]!=cnt-1) return "";\n                }\n                if(cnt+i>=r){\n                    for(int x=j+r-i,y=r+1;y<=cnt+i;y++,x++){\n                        ans+=ans[x];\n                    }\n                    r=ans.length();\n                }else{\n                    continue;\n                }\n            }\n            if(ans.length()==prev && ans.length()<i+1){\n                if(z<26){\n                    ans+=(\'a\'+z);\n                    z++;\n                }else{\n                    return "";\n                }\n            }\n            r=ans.length();\n            prev=r;\n        }\n        if(ans.length()!=n) return "";\n        vector<vector<int>> lcp1(n,vector<int>(n,0));\n        for(int i=n-1;i>=0;i--){\n            for(int j=n-1;j>=0;j--){\n                if(ans[i]==ans[j]){\n                    lcp1[i][j]=1;\n                    if(i+1<n && j+1<n){\n                        lcp1[i][j]+=lcp1[i+1][j+1];\n                    }\n                }\n                lcp1[j][i]=lcp1[i][j];\n                if(lcp1[i][j]!=lcp[i][j]) return "";\n            }\n        }\n        return ans;\n    }\n};\n```
['C++']