@[smile_jyc](/user/1246532) this:
```cpp
#include <bits/stdc++.h>
using namespace std;
namespace drest {
#define _fcfo friend const fast_io& operator
#define _io const fast_io& io
#define _gething1(_ch) (bool) ((_ch=getchar())==' '||_ch=='\n'||_ch=='\t'||_ch==4)
#define _gething2(_ch) (bool) ((_ch = getchar())<'0'||_ch>'9')
/* code by Drest */
const char* _website_ = "dresteam.online";
using std::string; using std::pair; using std::map; using std::set;
using std::vector; using std::queue; using std::deque; using std::priority_queue;
using std::sort; using std::swap; using std::min; using std::max;
using std::floor; using std::ceil; char _ch_;
template<class T> T abs(const T & x) {return x < 0 ? -x : x;}
class fast_io {
template<class T> static const fast_io& input_integer(_io, T &x) {
T f = 1, res; while(_gething2(_ch_)) if(_ch_ == '-') f = -1; res = _ch_ ^ 48;
while(!_gething2(_ch_)) res= (res << 1) + (res << 3) + (_ch_ ^ 48); x = res * f; return io;
}
template<class T> static const fast_io& output_integer(_io, T &x)
{if(x<0)putchar('-'); x = abs(x); if(x>9)io<<(T)(x/10); putchar(x%10+'0'); return io;}
_fcfo >> (_io, bool &x) {return input_integer(io, x);}
_fcfo >> (_io, short &x) {return input_integer(io, x);}
_fcfo >> (_io, int &x) {return input_integer(io, x);}
_fcfo >> (_io, long &x) {return input_integer(io, x);}
_fcfo >> (_io, long long &x) {return input_integer(io, x);}
_fcfo >> (_io, __int128 &x) {return input_integer(io, x);}
_fcfo << (_io, short x) {return output_integer(io, x);}
_fcfo << (_io, int x) {return output_integer(io, x);}
_fcfo << (_io, long x) {return output_integer(io, x);}
_fcfo << (_io, long long x) {return output_integer(io, x);}
_fcfo << (_io, __int128 x) {return output_integer(io, x);}
_fcfo >> (_io, float &x) {scanf("%f", &x); return io;}
_fcfo >> (_io, double &x) {scanf("%lf", &x); return io;}
_fcfo << (_io, float x) {printf("%f", x); return io;}
_fcfo << (_io, double x) {printf("%lf", x); return io;}
_fcfo >> (_io, char &x) {while(_gething1(x)){} return io;}
_fcfo << (_io, char x) {putchar(x); return io;}
_fcfo >> (_io, string &x) {while(_gething1(_ch_)){} x = _ch_; while(!_gething1(_ch_)) x += _ch_; return io;}
_fcfo << (_io, string x) {for(int i=0; i < x.size(); i++)putchar(x[i]); return io;}
_fcfo >> (_io, char* &x) {string res; io >> res; x=&res[0]; return io;}
_fcfo << (_io, char* x) {for (int i=0; i < strlen(x); i++) putchar(x[i]); return io;}
public:
fast_io& getline(string &x) {x = ""; while ((_ch_ = getchar()) != '\n' && _ch_ != 4) x += _ch_; return *this;}
fast_io& getline(char* &x) {string res; this->getline(res); x = &res[0]; return *this;}
};
fast_io io, cin, cout; const char & endl = '\n';
}
#define cin io
#define cout io
#define endl '\n'
using namespace drest;
string x;
int main ()
{
cin>>x;
vector<int> a (x.size ()+1);
for (int i=0;i<x.size ();i++)
a[i+1]=x[i]-48;
sort (a.begin ()+1,a.end ());
do
{
for (int i=1;i<=x.size ();i++) cout<<a[i];
cout<<endl;
}while (next_permutation (a.begin ()+1,a.end ()));
return 0;
}
```
by hhhcj @ 2024-04-24 20:41:47