I am a beginner in python so this may seem easy to some people but I am stuck and don't know how to do this.
What I want to do is to write a python code that takes a string like "abc" then it generates all possible combinations of the string based on capital and small letters without changing the sequence of the letters.
for example if the input is abc
the output should be:
- abc
- Abc
- ABc
- ABC
- aBC
- abC
- AbC
- aBc
You might have noticed that number of the outputs will be 2^(number of alphabetic characters in the string)
Does any one have any idea how this can be done?
And further, solution should work correctly when the source string contains not only letters, but some special chars such as @
and .
Because, for example, @
does not have lower case it will give me some duplicates in the output , how can I make it so only alphabetic characters are upper/lower ? for example if the input is a@c the output shoud only be :
- A@c
- a@C
- A@C
- a@c
Thanks in advance!