<p>Given a string <code>s</code>, you&nbsp;can transform every letter individually to be lowercase or uppercase to create another string.</p>

<p>Return <em>a list of all possible strings we could create</em>. Return the output in <strong>any order</strong>.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>

<pre>
<strong>Input:</strong> s = &quot;a1b2&quot;
<strong>Output:</strong> [&quot;a1b2&quot;,&quot;a1B2&quot;,&quot;A1b2&quot;,&quot;A1B2&quot;]
</pre>

<p><strong class="example">Example 2:</strong></p>

<pre>
<strong>Input:</strong> s = &quot;3z4&quot;
<strong>Output:</strong> [&quot;3z4&quot;,&quot;3Z4&quot;]
</pre>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>1 &lt;= s.length &lt;= 12</code></li>
	<li><code>s</code> consists of lowercase English letters, uppercase English letters, and digits.</li>
</ul>

class Solution {
public:
    

    void perm(string s,string op,vector <string> &ans){
        if(s.length() == 0){
            ans.push_back(op);
            return;
        }

        string op1 = op;

        string op2 = op;

        if(s[0] >= 65 && s[0] <= 90){
            op1 += (s[0] + 32);
        }

        else if(s[0] >= 97 && s[0] <= 122){
            op1 += (s[0] - 32);
        }

        else op1 += s[0];

        op2 += s[0];

        s.erase(s.begin() + 0);

        perm(s,op1,ans);

        perm(s,op2,ans);

        // return ans;
    }

    vector<string> letterCasePermutation(string s) {

        string op = "";
        vector <string> ans;

        perm(s,op,ans);

        unordered_set <string> se;

        for(auto it : ans) se.insert(it);

        vector <string> anss;

        for(auto it : se) anss.push_back(it);
        
        return anss;

    }
};
19000