C++ solution | Logic building
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:$$O(n2)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:$$O(1)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    string findTheString(vector<vector<int>>& lcp) {\n        int n=lcp.size();\n        string ans="";\n        if(lcp[0][0]!=n)\n        return ans;\n        for(int i=0;i<n;i++){\n            for(int j=0;j<n;j++){\n                if(lcp[i][j]!=lcp[j][i] || lcp[i][j]>n-max(i,j))\n                return ans;\n                if(i+1<n && j+1<n && lcp[i][j]>0 && lcp[i+1][j+1]!=lcp[i][j]-1)\n                return ans;\n            }\n        }\n        int t=0;\n        for(int i=0;i<n;i++)\n        ans+=\'1\';\n        for(int i=0;i<n;i++){\n            bool flag=false;\n            for(int j=i;j<n;j++){\n                if(ans[j]==\'1\'&& lcp[i][j]!=0){\n                    if(t>=26)\n                    return "";\n                    ans[j]=\'a\'+t;\n                    flag=true;\n                }\n            }\n            if(flag==true)\n            t++;\n        }\n        for(int i=0;i<n;i++){\n            for(int j=0;j<n;j++){\n                if(lcp[i][j]!=0 && ans[i]!=ans[j])\n                return "";\n            }\n        }\n        return ans;\n    }\n};\n```
['String', 'Matrix', 'C++']