<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 {
    int check(char ch){
        if(islower(ch)) return 1;
        if(isupper(ch)) return -1;
        return 0;
    }

    void f(int i,string s,string st,vector<string>& store,int n){
        if(i==n){
            store.push_back(st);
            return;
        }
        int ch = check(s[i]);
        f(i+1,s,st+s[i],store,n);
        if(ch==1){
            char c = toupper(s[i]);
            st.push_back(c);
            f(i+1,s,st,store,n);
            st.pop_back();
        }else if(ch==-1){
            char c = tolower(s[i]);
            st.push_back(c);
            f(i+1,s,st,store,n);
            st.pop_back();
        }
    }
public:
    vector<string> letterCasePermutation(string s) {
        vector<string> res;
        string st = "";
        int n = s.size();
        f(0,s,st,res,n);
        return res;
    }
};
14300