fork download
  1. #include <bits/stdc++.h>
  2. #define ll long long
  3. #define int long long
  4. #define double long double
  5. #define endl "\n"
  6. #define fi first
  7. #define se second
  8. #define MASK(i) (1LL << (i))
  9. #define BIT(x, i) (((x) >> (i)) & 1)
  10. #define creby_ThienNhan return 0;
  11. #define qnorz ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
  12. using namespace std;
  13. const int LimN=2e5+5;
  14. const int N=1e5+5;
  15. const int M=1e3+5;
  16. const int BASE=256;
  17. const int mod=1e9+7;
  18. char d4c[4]={'R','D','L','U'};
  19. ll d4x[4]={0,1,0,-1};
  20. ll d4y[4]={1,0,-1,0};
  21. ll d4x_tuong[4]={-2,-2,2,2};
  22. ll d4y_tuong[4]={-2,2,-2,2};
  23. ll d8x[8]={0,1,-1,0,-1,1,1,-1};
  24. ll d8y[8]={1,0,0,-1,-1,1,-1,1};
  25. ll d8x_ma[8]={-1,-1,+1,+1,-2,-2,+2,+2};
  26. ll d8y_ma[8]={-2,+2,-2,+2,-1,+1,-1,+1};
  27. template<class X, class Y>
  28. bool maximize(X& x, const Y y) {
  29. if (y > x) {x = y; return true;}
  30. return false;
  31. }
  32. template<class X, class Y>
  33. bool minimize(X& x, const Y y) {
  34. if (y < x) {x = y; return true;}
  35. return false;
  36. }
  37. ll pow1(ll a, ll b, ll c){
  38. ll tich = 1;
  39. a = a % c;
  40. for (; b > 0; b >>= 1 , a = a * a % c){
  41. if (b & 1) tich = tich * a % c;
  42. }
  43. return tich;
  44. }
  45. ll pow2(ll a, ll b, ll mod) {
  46. ll res = 1;
  47. a %= mod;
  48. while(b > 0) {
  49. if(b & 1) res = (res * a) % mod;
  50. a = (a * a) % mod;
  51. b >>= 1;
  52. }
  53. return res;
  54. }
  55. namespace SUB1{
  56.  
  57. }
  58. namespace SUB2{
  59.  
  60. }
  61. namespace SUB3{
  62.  
  63. }
  64.  
  65. void solve() {
  66. string n;
  67. getline(cin,n);
  68. string s1=n;
  69. string s2=n;
  70. sort(s1.begin(),s1.end());
  71. sort(s2.begin(),s2.end(),greater<char>());
  72. cout << s2 << endl;
  73. char min1='9';
  74. for (int i=0; i<s1.size(); i++) {
  75. if (s1[i]!='0' && s1[i] < min1) {
  76. min1=s1[i];
  77. }
  78. }
  79. cout << min1;
  80. bool kt=true;
  81. for (int i=0; i<s1.size(); i++) {
  82. if (s1[i]!=min1) cout << s1[i];
  83. else {
  84. if (kt==true) {
  85. kt=false;
  86. }
  87. else {
  88. cout << s1[i];
  89. }
  90. }
  91. }
  92.  
  93. }
  94.  
  95. signed main() {
  96. qnorz
  97. ll t=1;
  98. while (t--) {
  99. solve();
  100. }
  101. creby_ThienNhan
  102. }
  103.  
  104.  
Success #stdin #stdout 0s 5304KB
stdin
1801
stdout
8110
1018