Language: C++

#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
  string s;
  cin>>s;
  sort(s[0],s[s.size()-1]);
  cout<<((s[0]==s[1] and s[1]!=s[2] and s[2]==s[3])?"Yes":"No")<<endl;}


Compiler output:
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/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:8:7:   required from here
    8 |   sort(s[0],s[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 '_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:8:7:   required from here
    8 |   sort(s[0],s[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 _RandomAccessIterator, class _Compare> _RandomAccessIterator std::__unguarded_partition(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare)'
 1829 |     __unguarded_partition(_RandomAccessIterator __first,
      |     ^~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1829:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1857:40: note:   deduced conflicting types for parameter '_RandomAccessIterator' ('int' and 'char')
 1857 |       return std::__unguarded_partition(__first + 1, __last, __first, __comp);
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algo.h:61:
/usr/include/c++/14/bits/stl_heap.h: In instantiation of 'void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = char; _Compare = __gnu_cxx::__ops::_Iter_less_iter]':
/usr/include/c++/14/bits/stl_algo.h:1593:23:   required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = char; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
 1593 |       std::__make_heap(__first, __middle, __comp);
      |       ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1868:25:   required from 'void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = char; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
 1868 |       std::__heap_select(__first, __middle, __last, __comp);
      |       ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1884:27:   required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = char; _Size = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
 1884 |               std::__partial_sort(__first, __last, __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:8:7:   required from here
    8 |   sort(s[0],s[s.size()-1]);
      |   ~~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:344:11: error: no type named 'value_type' in 'struct std::iterator_traits<char>'
  344 |           _ValueType;
      |           ^~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:346:11: error: no type named 'difference_type' in 'struct std::iterator_traits<char>'
  346 |           _DistanceType;
      |           ^~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:71,
                 from /usr/include/c++/14/string:51,
                 from /usr/include/c++/1