#include <bits/stdc++.h>
using namespace std;
vector<string> all;
void fun(string s,int idx, string s1,int n){
if(idx==n){
if(s1.size()==0) all.push_back("null");
all.push_back(s1);
return ;
}
s1.push_back(s[idx]);
fun(s,idx+1,s1,n);
s1.pop_back();
fun(s,idx+1,s1,n);
}
int main()
{
string s="312",s1;
fun(s,0,s1,3);
for(int i=0;i<all.size();i++) cout<<all[i]<<" ";
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: