Given an array, print all possible combinations of it's elements. (Note that this would be the equivalent of calling an n-choose-k function n - 1 times where k is 1 on the first call and incremented by one on each subsequent call.)

Input: a b c
Output: a, a b, a b c, a c, b, b c, c

void Combinations(vector<char> &arr)
    vector<char> res;
    CombinationsHelper(arr, res, 0);
void CombinationsHelper(vector<char> &arrvector<charresint index)
    if (index == arr.size())
    for (int i = index; i < arr.size(); i++)
        for (char c : res)
            cout << c;
        cout << endl;
        CombinationsHelper(arrres, i + 1);