Description

Given a string s, transform every letter individually to be lowercase or uppercase. Return all possible permutations.

Examples

Input:s = "a1b2"
Output:["a1b2","a1B2","A1b2","A1B2"]
Explanation:

All case variations.

Input:s = "C2c"
Output:["C2c","C2C","c2c","c2C"]
Explanation:

String contains uppercase and lowercase letters with a digit. Each letter can be toggled between cases: first 'C' can be 'C' or 'c', last 'c' can be 'c' or 'C', giving us 2×2=4 total permutations.

Input:s = "12E"
Output:["12E","12e"]
Explanation:

String starts with digits and ends with one letter. Only the letter 'E' can change case to 'e', so this gives exactly 2 permutations while the digits '12' remain unchanged in all variations.

Constraints

  • 1 ≤ s.length ≤ 12

Ready to solve this problem?

Practice solo or challenge other developers in a real-time coding battle!