Subsets using bitmasking

I want to create generic function for this subset generator using bitmasking.
Code Link - https://ide.codingblocks.com/s/405323
Kindly help me generate the generic fucntion which accepts both char a[100] and string data type.

Hey @meet1708