Advertisement
MMBC

Possible strings

Nov 18th, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 KB | None | 0 0
  1. #include <string>
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. void get( string str, string res ) {
  6.  
  7.    cout << res << endl;
  8.  
  9.    for( int i = 0; i < str.length(); i++ )
  10.       get( string(str).erase(i,1), res + str[i] );
  11. }
  12.  
  13. int main( int argc, char **argv) {
  14.  
  15.    string str = "abcde";
  16.    get( str, "" );  
  17.    return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement