Answers for "find case perumations"

C++
0

find case perumations

void change_case(char &c){
    if(c >= 'A' and c <= 'Z')
        c += 32;
    else if(c >= 'a' and c <= 'z')
        c -= 32;
}

void find_case_permutations(string s, vector<string> &res, size_t index){
    res.push_back(s);
    for(size_t i = index; i < s.size(); ++i){
        string s1 = s;
        if(s1[i] >= 'A') change_case(s1[i]);
        else continue;
        find_case_permutations(s1, res, i+1);
    }
}

find_case_permutations("ab7c", res, 0);
Posted by: Guest on August-05-2021

Code answers related to "find case perumations"

Browse Popular Code Answers by Language