Ascii subsequences ,only sample case passes

#include<bits/stdc++.h>

using namespace std;
setss;
void ascii_subs(string in ,string out)
{
if (in.size()==1)
{
ss.insert(out);
ss.insert(out+in);
int av=in[0];
ss.insert(out + to_string(av));
return;
}

ascii_subs(in.substr(1),out);

ascii_subs(in.substr(1),out + in[0]);

ascii_subs(in.substr(1),out+ to_string((int)in[0]));

}

int main(){
ios_base::sync_with_stdio(false);
cin.tie();
string inn;
cin>>inn;
ascii_subs(inn,"");
cout<<ss.size()<<endl;
copy(ss.begin(),ss.end(),ostream_iterator(cout," "));

}

Is the logic wrong, hints req!!

Can you please provide the question link ?

https://hack.codingblocks.com/contests/c/452/355

		#include<bits/stdc++.h>
					using namespace std;
					vector<string>s;
					void as(string in , string out)
					{
						if(in.size()==1)
						{
							s.push_back(out);
						

							s.push_back(out+in[0]);

							s.push_back(out+ to_string((int)(in[0])));
							return;
						}

					 as(in.substr(1),out);
					 as(in.substr(1),out+in[0]);
					 as(in.substr(1),out+to_string((int)in[0]));

					}

					int main(){
						string ss;
						cin>>ss;
						as(ss,"");
						cout<<s.size()<<"\n";
						for(const auto& it: s)
						{
							cout<<it<<" ";
						}
					}

this works now :slight_smile: