// stringpattern.cpp : Defines the entry point for the console applic
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
void find_subset(char *set, char *subset,int n, int k, int j);
int main()
{
//FILE *fd;
int n,k=0,i;
char set[100], subset[100],ch;
ch='A';
printf("Enter length of the set:");
scanf("%d",&n);
printf("Enter the set:");
for (i = 0; i <n; i++)
{
set[i]=ch;
ch++;
}
printf("Enter the value of k(size of subset):");
scanf("%d",&k);
find_subset(set, subset, n, k, 0);
getchar();
return 0;
`}`
void find_subset(char *set, char *subset,int n, int k, int j)
{
//FILE *fd;
int i;
//fd=fopen("C:/Users/Zahid/Desktop/dslab.txt","w+");
if (k == 0)
{
subset[j]= '\0';
printf("\n%s",subset);
return;
}
//fclose(fd);
for(i = 0; i < n; i++)
{
subset[j] = set[i];
find_subset(set, subset, n, k-1, j+1);
}
}
/// using this code i can generate any number of possible string... but is there any other possible easy way to solve this problem