xxxxxxxxxx
void PossibleCombinations(string str, int index, Stack<string> stack)
{
if (index == str.Length)
{
// print elements from stack;
return;
}
for (int i = index; i < str.Length; i++)
{
stack.Push(str.Substring(index, i + 1 - index));
PossibleCombinations(str, i + 1, stack);
if (stack.Count > 0)
stack.Pop();
}
}