Language: C++

#include<bits/stdc++.h>
using namespace std;

int main(){
  string s, t;
  
  cin >> s >> t;
  
  sort(s.at(1), s.at(s.size() - 1));
  sort(s.at(1), s.at(s.size() - 1), greater<int>());
  
  string re;
  if(s < t){
    re = "Yes";
  } else {
    re = "No";
  }
  
  cout << re << endl;
  
  return 0;
}

Compiler output:
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h: In instantiation of 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = char; _Compare = __gnu_cxx::__ops::_Iter_less_iter]':
/usr/include/c++/14/bits/stl_algo.h:1908:31:   required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = char; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
 1908 |           std::__final_insertion_sort(__first, __last, __comp);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4772:18:   required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = char]'
 4772 |       std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter());
      |       ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:9:7:   required from here
    9 |   sort(s.at(1), s.at(s.size() - 1));
      |   ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1817:32: error: no matching function for call to '__insertion_sort(char&, int, __gnu_cxx::__ops::_Iter_less_iter&)'
 1817 |           std::__insertion_sort(__first, __first + int(_S_threshold), __comp);
      |           ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1770:5: note: candidate: 'template<class _RandomAccessIterator, class _Compare> void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare)'
 1770 |     __insertion_sort(_RandomAccessIterator __first,
      |     ^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1770:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1817:32: note:   deduced conflicting types for parameter '_RandomAccessIterator' ('char' and 'int')
 1817 |           std::__insertion_sort(__first, __first + int(_S_threshold), __comp);
      |           ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1818:42: error: no matching function for call to '__unguarded_insertion_sort(int, char&, __gnu_cxx::__ops::_Iter_less_iter&)'
 1818 |           std::__unguarded_insertion_sort(__first + int(_S_threshold), __last,
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1819 |                                           __comp);
      |                                           ~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1794:5: note: candidate: 'template<class _RandomAccessIterator, class _Compare> void std::__unguarded_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare)'
 1794 |     __unguarded_insertion_sort(_RandomAccessIterator __first,
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1794:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1818:42: note:   deduced conflicting types for parameter '_RandomAccessIterator' ('int' and 'char')
 1818 |           std::__unguarded_insertion_sort(__first + int(_S_threshold), __last,
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1819 |                                           __comp);
      |                                           ~~~~~~~
/usr/include/c++/14/bits/stl_algo.h: In instantiation of 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = char; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]':
/usr/include/c++/14/bits/stl_algo.h:1908:31:   required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = char; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]'
 1908 |           std::__final_insertion_sort(__first, __last, __comp);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4805:18:   required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = char; _Compare = greater<int>]'
 4805 |       std::__sort(__first, __last, __gnu_cxx::__ops::__iter_comp_iter(__comp));
      |       ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:10:7:   required from here
   10 |   sort(s.at(1), s.at(s.size() - 1), greater<int>());
      |   ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1817:32: error: no matching function for call to '__insertion_sort(char&, int, __gnu_cxx::__ops::_Iter_comp_iter<std::greater<int> >&)'
 1817 |           std::__insertion_sort(__first, __first + int(_S_threshold), __comp);
      |           ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1770:5: note: candidate: 'template<class _RandomAccessIterator, class _Compare> void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare)'
 1770 |     __insertion_sort(_RandomAccessIterator __first,
      |     ^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1770:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1817:32: note:   deduced conflicting types for parameter '_RandomAccessIterator' ('char' and 'int')
 1817 |           std::__insertion_sort(__first, __first + int(_S_threshold), __comp);
      |           ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1818:42: error: no matching function for call to '__unguarded_insertion_sort(int, char&, __gnu_cxx::__ops::_Iter_comp_iter<std::greater<int> >&)'
 1818 |           std::__unguarded_insertion_sort(__first + int(_S_threshold), __last,
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1819 |                                           __comp);
      |                                           ~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1794:5: note: candidate: 'template<class _RandomAccessIterator, class _Compare> void std::__unguarded_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare)'
 1794 |     __unguarded_insertion_sort(_RandomAccessIterator __first,
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1794:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1818:42: note:   deduced conflicting types for parameter '_RandomAccessIterator' ('int' and 'char')
 1818 |           std::__unguarded_insertion_sort(__first + int(_S_threshold), __last,
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1819 |                                           __comp);
      |                                           ~~~~~~~
/usr/include/c++/14/bits/stl_algo.h: In instantiation of '_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = char; _Compare = __gnu_cxx::__ops::_Iter_less_iter]':
/usr/include/c++/14/bits/stl_algo.h:1889:38:   required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = char; _Size = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
 1889 |             std::__unguarded_partition_pivot(__first, __last, __comp);
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1905:25:   required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = char; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
 1905 |           std::__introsort_loop(__first, __last,
      |           ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
 1906 |                                 std::__lg(__last - __first) * 2,
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1907 |                                 __comp);
      |                                 ~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4772:18:   required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = char]'
 4772 |       std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter());
      |       ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:9:7:   required from here
    9 |   sort(s.at(1), s.at(s.size() - 1));
      |   ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1855:34: error: no matching function for call to '__move_median_to_first(char&, int, char&, int, __gnu_cxx::__ops::_Iter_less_iter&)'
 1855 |       std::__move_median_to_first(__first, __first + 1, __mid, __last - 1,
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1856 |                                   __comp);
      |                                   ~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:85:5: note: candidate: 'template<class _Iterator, class _Compare> void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare)'
   85 |     __move_median_to_first(_Iterator __result,_Iterator __a, _Iterator __b,
      |     ^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:85:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1855:34: note:   deduced conflicting types for parameter '_Iterator' ('char' and 'int')
 1855 |       std::__move_median_to_first(__first, __first + 1, __mid, __last - 1,
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1856 |                                   __comp);
      |                                   ~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1857:40: error: no matching function for call to '__unguarded_partition(int, char&, char&, __gnu_cxx::__ops::_Iter_less_iter&)'
 1857 |       return std::__unguarded_partition(__first + 1, __last, __first, __comp);
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1829:5: note: candidate: 'template<class _RandomAcc