fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. string s;
  4. set<string> res;
  5. string tmp;
  6. void Try(int idx){
  7. for(char x : {tolower(s[idx]),toupper(s[idx])}){
  8. tmp += x;
  9. if(tmp.size() == s.size()){
  10. res.insert(tmp);
  11. }
  12. else{
  13. Try(idx+1);
  14. }
  15. tmp.pop_back();
  16. }
  17. }
  18. int main(){
  19. cin >> s;
  20. Try(0);
  21. for(string x : res){
  22. cout << x << endl;
  23. }
  24. }
Success #stdin #stdout 0.01s 5308KB
stdin
28TeCH
stdout
28TECH
28TECh
28TEcH
28TEch
28TeCH
28TeCh
28TecH
28Tech
28tECH
28tECh
28tEcH
28tEch
28teCH
28teCh
28tecH
28tech