#include <stdio.h>
void printPowerSet(char *set, int l , int h , int size)
{
int i=l;
for(i
=l
;i
<=h
;i
++){printf("%c",set
[i
]);} if(l+1 < size){ printPowerSet(set,l+1,h,size); }
if(h-1 >= 0 ){printPowerSet(set,l,h-1,size);}
if( l+1<size && h-1 >=0) {printPowerSet(set,l+1,h-1,size);}
}//printpowerset
int main(void) {
char set[] = {'a','b','c'};
printPowerSet(set,0,2,3 );
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CnZvaWQgcHJpbnRQb3dlclNldChjaGFyICpzZXQsIGludCBsICwgaW50IGggLCBpbnQgc2l6ZSkKewppbnQgaT1sOwpmb3IoaT1sO2k8PWg7aSsrKXtwcmludGYoIiVjIixzZXRbaV0pO30KcHJpbnRmKCJcbiIpOwppZihsKzEgPCBzaXplKXsgcHJpbnRQb3dlclNldChzZXQsbCsxLGgsc2l6ZSk7IH0KaWYoaC0xID49IDAgKXtwcmludFBvd2VyU2V0KHNldCxsLGgtMSxzaXplKTt9CmlmKCBsKzE8c2l6ZSAmJiBoLTEgPj0wKSB7cHJpbnRQb3dlclNldChzZXQsbCsxLGgtMSxzaXplKTt9Cn0vL3ByaW50cG93ZXJzZXQKaW50IG1haW4odm9pZCkgewpjaGFyIHNldFtdID0geydhJywnYicsJ2MnfTsKICAgIHByaW50UG93ZXJTZXQoc2V0LDAsMiwzICk7CgogICAgZ2V0Y2hhcigpOwogCglyZXR1cm4gMDsKfQ==