Guest User

Untitled

a guest
Dec 27th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.41 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. void print(string s, string o, int i, int j, int & count){
  4.     if(s[i]=='\0'){
  5.         o[j] = '\0';
  6.         cout<<o<<" ";
  7.         count++;
  8.     }
  9.     o[j] = s[i];
  10.     print(s, o, i+1, j + 1, count);
  11.     print(s, o, i+1, j, count);
  12. }
  13.  
  14. int main(){
  15.     string s, o ="";
  16.     cin>>s;
  17.     int count = 1;
  18.    
  19.     print(s, o, 0, 0, count);
  20.     cout<<"\n"<<count<<endl;
Add Comment
Please, Sign In to add comment