Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- void print(string s, string o, int i, int j, int & count){
- if(s[i]=='\0'){
- o[j] = '\0';
- cout<<o<<" ";
- count++;
- }
- o[j] = s[i];
- print(s, o, i+1, j + 1, count);
- print(s, o, i+1, j, count);
- }
- int main(){
- string s, o ="";
- cin>>s;
- int count = 1;
- print(s, o, 0, 0, count);
- cout<<"\n"<<count<<endl;
Add Comment
Please, Sign In to add comment