all permutation using inbuit function c++

#include <iostream> #include <bits/stdc++.h> using namespace std; void perm(string s){ sort(s.begin(),s.end()); while(1){ cout<<s<<" "; if(next_permutation(s.begin(),s.end())==false)break; } cout<<endl; } int main() { //code int t; cin>>t; string s; while(t-->0){ cin>>s; perm(s); } return 0; }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.