<p>Given an array of strings <code>strs</code>, return <em>the length of the <strong>longest uncommon subsequence</strong> between them</em>. If the longest uncommon subsequence does not exist, return <code>-1</code>.</p>

<p>An <strong>uncommon subsequence</strong> between an array of strings is a string that is a <strong>subsequence of one string but not the others</strong>.</p>

<p>A <strong>subsequence</strong> of a string <code>s</code> is a string that can be obtained after deleting any number of characters from <code>s</code>.</p>

<ul>
	<li>For example, <code>&quot;abc&quot;</code> is a subsequence of <code>&quot;aebdc&quot;</code> because you can delete the underlined characters in <code>&quot;a<u>e</u>b<u>d</u>c&quot;</code> to get <code>&quot;abc&quot;</code>. Other subsequences of <code>&quot;aebdc&quot;</code> include <code>&quot;aebdc&quot;</code>, <code>&quot;aeb&quot;</code>, and <code>&quot;&quot;</code> (empty string).</li>
</ul>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<pre><strong>Input:</strong> strs = ["aba","cdc","eae"]
<strong>Output:</strong> 3
</pre><p><strong class="example">Example 2:</strong></p>
<pre><strong>Input:</strong> strs = ["aaa","aaa","aa"]
<strong>Output:</strong> -1
</pre>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>2 &lt;= strs.length &lt;= 50</code></li>
	<li><code>1 &lt;= strs[i].length &lt;= 10</code></li>
	<li><code>strs[i]</code> consists of lowercase English letters.</li>
</ul>

class Solution {
public:
    int findLUSlength(vector<string>& strs) {
        int n=strs.size();
        vector<pair<int,string>> v(n);
        for(int i=0;i<n;i++){
            v[i]={strs[i].size(),strs[i]};
        }
        sort(v.begin(),v.end());
        map<string,int> sub_str;
        int i=n-1;
        while(i>=0){
            map<string,int> mp;
            int len=v[i].first,count=0;
            while(i>=0 && v[i].first==len){
                if(sub_str.find(v[i].second)==sub_str.end()){
                    mp[v[i].second]++;
                    count++;
                }
                i--;
            }
            for(auto it:mp){
                cout<<it.first<<" ";
            }
            cout<<endl;
            if(mp.size()>1){
                bool check=false;
                for(auto it:mp){
                    if(it.second==1){
                        check=true;
                        break;
                    }
                }
                if(check){
                    return len;
                }
            }
            if(mp.size()==1 && count==1){
                return len;
            }
            for(auto it:mp){
                //cout<<pow(2,it.first.size())<<endl;
                //int num=0;
                for(int j=1;j<pow(2,it.first.size());j++){
                    string s="";
                    for(int k=0;k<it.first.size();k++){
                        if(j&(1<<k)){
                            s.push_back(it.first[k]);
                        }
                        //num++;
                    }
                    sub_str[s]++;
                }
                //cout<<num<<endl;
                // for(int j=0;j<it.first.size();j++){
                //     for(int k=j;k<it.first.size();k++){
                //         sub_str[it.first.substr(j,k-j+1)]++;
                //     }
                // }
            }
        }
        return -1;
    }
};
13943