class Solution:
    def letterCasePermutation(self, S: str) -> List[str]:
        S = S.lower()
        n = len(S)
        ans = []
        def perm(i, res):
            if i < n:
                perm(i+1, res + S[i])
                if S[i].islower(): perm(i+1, res + S[i].upper())
            else:
                ans.append(res)
        perm(0,'')
        return ans

# EOF #

df05b986a350a232e2287c8bd158323dd7e9d03f
<mask token>

class Solution:
    <mask token>

class Solution:

    def letterCasePermutation(self, S: str) ->List[str]:
        S = S.lower()
        n = len(S)
        ans = []

        def perm(i, res):
            if i < n:
                perm(i + 1, res + S[i])
                if S[i].islower():
                    perm(i + 1, res + S[i].upper())
            else:
                ans.append(res)
        perm(0, '')
        return ans

class Solution:
    def letterCasePermutation(self, S: str) -> List[str]:
        S = S.lower()
        n = len(S)
        ans = []
        def perm(i, res):
            if i < n:
                perm(i+1, res + S[i])
                if S[i].islower(): perm(i+1, res + S[i].upper())
            else:
                ans.append(res)
        perm(0,'')
        return ans

# EOF #
