Language: C++

#include<iostream>
#include<cstring>
using namespace std;

main(){
  string s;
  cin >> s;
  if (s.size()==3) swap(s.begin,s.end);
  cout << s << endl;
}


Compiler output:
a.cc:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:8:24: error: no matching function for call to 'swap(<unresolved overloaded function type>, <unresolved overloaded function type>)'
    8 |   if (s.size()==3) swap(s.begin,s.end);
      |                    ~~~~^~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
                 from /usr/include/c++/14/string:68,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/tuple:2805:5: note: candidate: 'typename std::enable_if<std::__and_<std::__is_swappable<_Elements>...>::value>::type std::swap(tuple<_UTypes ...>&, tuple<_UTypes ...>&) [with _Elements = {}; typename enable_if<__and_<__is_swappable<_Elements>...>::value>::type = void]'
 2805 |     swap(tuple<_Elements...>& __x, tuple<_Elements...>& __y)
      |     ^~~~
/usr/include/c++/14/tuple:2805:31: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::tuple<>&'
 2805 |     swap(tuple<_Elements...>& __x, tuple<_Elements...>& __y)
      |          ~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/exception:166,
                 from /usr/include/c++/14/ios:41:
/usr/include/c++/14/bits/exception_ptr.h:229:5: note: candidate: 'void std::__exception_ptr::swap(exception_ptr&, exception_ptr&)'
  229 |     swap(exception_ptr& __lhs, exception_ptr& __rhs)
      |     ^~~~
/usr/include/c++/14/bits/exception_ptr.h:229:25: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::__exception_ptr::exception_ptr&'
  229 |     swap(exception_ptr& __lhs, exception_ptr& __rhs)
      |          ~~~~~~~~~~~~~~~^~~~~
In file included from /usr/include/c++/14/bits/exception_ptr.h:41:
/usr/include/c++/14/bits/move.h:226:5: note: candidate: 'template<class _Tp> std::_Require<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&)'
  226 |     swap(_Tp& __a, _Tp& __b)
      |     ^~~~
/usr/include/c++/14/bits/move.h:226:5: note:   template argument deduction/substitution failed:
a.cc:8:24: note:   couldn't deduce template parameter '_Tp'
    8 |   if (s.size()==3) swap(s.begin,s.end);
      |                    ~~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/move.h:250:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> std::__enable_if_t<((bool)std::__is_swappable<_Tp>::value)> std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])'
  250 |     swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
      |     ^~~~
/usr/include/c++/14/bits/move.h:250:5: note:   template argument deduction/substitution failed:
a.cc:8:24: note:   mismatched types '_Tp [_Nm]' and 'std::__cxx11::basic_string<char>::const_iterator (std::__cxx11::basic_string<char>::*)() const noexcept'
    8 |   if (s.size()==3) swap(s.begin,s.end);
      |                    ~~~~^~~~~~~~~~~~~~~
a.cc:8:24: note:   mismatched types '_Tp [_Nm]' and 'std::__cxx11::basic_string<char>::iterator (std::__cxx11::basic_string<char>::*)() noexcept'
a.cc:8:24: note:   mismatched types '_Tp [_Nm]' and 'std::__cxx11::basic_string<char>::const_iterator (std::__cxx11::basic_string<char>::*)() const noexcept'
a.cc:8:24: note:   mismatched types '_Tp [_Nm]' and 'std::__cxx11::basic_string<char>::iterator (std::__cxx11::basic_string<char>::*)() noexcept'
a.cc:8:24: note:   couldn't deduce template parameter '_Tp'
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_pair.h:1089:5: note: candidate: 'template<class _T1, class _T2> typename std::enable_if<std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value>::type std::swap(pair<_T1, _T2>&, pair<_T1, _T2>&)'
 1089 |     swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)
      |     ^~~~
/usr/include/c++/14/bits/stl_pair.h:1089:5: note:   template argument deduction/substitution failed:
a.cc:8:24: note:   mismatched types 'std::pair<_T1, _T2>' and 'std::__cxx11::basic_string<char>::const_iterator (std::__cxx11::basic_string<char>::*)() const noexcept'
    8 |   if (s.size()==3) swap(s.begin,s.end);
      |                    ~~~~^~~~~~~~~~~~~~~
a.cc:8:24: note:   mismatched types 'std::pair<_T1, _T2>' and 'std::__cxx11::basic_string<char>::iterator (std::__cxx11::basic_string<char>::*)() noexcept'
a.cc:8:24: note:   mismatched types 'std::pair<_T1, _T2>' and 'std::__cxx11::basic_string<char>::const_iterator (std::__cxx11::basic_string<char>::*)() const noexcept'
a.cc:8:24: note:   mismatched types 'std::pair<_T1, _T2>' and 'std::__cxx11::basic_string<char>::iterator (std::__cxx11::basic_string<char>::*)() noexcept'
a.cc:8:24: note:   couldn't deduce template parameter '_T1'
/usr/include/c++/14/bits/stl_pair.h:1106:5: note: candidate: 'template<class _T1, class _T2> typename std::enable_if<(! std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value)>::type std::swap(pair<_T1, _T2>&, pair<_T1, _T2>&)' (deleted)
 1106 |     swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete;
      |     ^~~~
/usr/include/c++/14/bits/stl_pair.h:1106:5: note:   template argument deduction/substitution failed:
a.cc:8:24: note:   mismatched types 'std::pair<_T1, _T2>' and 'std::__cxx11::basic_string<char>::const_iterator (std::__cxx11::basic_string<char>::*)() const noexcept'
    8 |   if (s.size()==3) swap(s.begin,s.end);
      |                    ~~~~^~~~~~~~~~~~~~~
a.cc:8:24: note:   mismatched types 'std::pair<_T1, _T2>' and 'std::__cxx11::basic_string<char>::iterator (std::__cxx11::basic_string<char>::*)() noexcept'
a.cc:8:24: note:   mismatched types 'std::pair<_T1, _T2>' and 'std::__cxx11::basic_string<char>::const_iterator (std::__cxx11::basic_string<char>::*)() const noexcept'
a.cc:8:24: note:   mismatched types 'std::pair<_T1, _T2>' and 'std::__cxx11::basic_string<char>::iterator (std::__cxx11::basic_string<char>::*)() noexcept'
a.cc:8:24: note:   couldn't deduce template parameter '_T1'
In file included from /usr/include/c++/14/string:54:
/usr/include/c++/14/bits/basic_string.h:4039:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> void std::swap(__cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 4039 |     swap(basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~
/usr/include/c++/14/bits/basic_string.h:4039:5: note:   template argument deduction/substitution failed:
a.cc:8:24: note:   mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'std::__cxx11::basic_string<char>::const_iterator (std::__cxx11::basic_string<char>::*)() const noexcept'
    8 |   if (s.size()==3) swap(s.begin,s.end);
      |                    ~~~~^~~~~~~~~~~~~~~
a.cc:8:24: note:   mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'std::__cxx11::basic_string<char>::iterator (std::__cxx11::basic_string<char>::*)() noexcept'
a.cc:8:24: note:   mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'std::__cxx11::basic_string<char>::const_iterator (std::__cxx11::basic_string<char>::*)() const noexcept'
a.cc:8:24: note:   mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'std::__cxx11::basic_string<char>::iterator (std::__cxx11::basic_string<char>::*)() noexcept'
a.cc:8:24: note:   couldn't deduce template parameter '_CharT'
/usr/include/c++/14/tuple:2823:5: note: candidate: 'template<class ... _Elements> typename std::enable_if<(! std::__and_<std::__is_swappable<_Elements>...>::value)>::type std::swap(tuple<_UTypes ...>&, tuple<_UTypes ...>&)' (deleted)
 2823 |     swap(tuple<_Elements...>&, tuple<_Elements...>&) = delete;
      |     ^~~~
/usr/include/c++/14/tuple:2823:5: note:   template argument deduction/substitution failed:
a.cc:8:24: note:   mismatched types 'std::tuple<_UTypes ...>' and 'std::__cxx11::basic_string<char>::const_iterator (std::__cxx11::basic_string<char>::*)() const noexcept'
    8 |   if (s.size()==3) swap(s.begin,s.end);
      |                    ~~~~^~~~~~~~~~~~~~~
a.cc:8:24: note:   mismatched types 'std::tuple<_UTypes ...>' and 'std::__cxx11::basic_string<char>::iterator (std::__cxx11::basic_string<char>::*)() noexcept'
a.cc:8:24: note:   mismatched types 'std::tuple<_UTypes ...>' and 'std::__cxx11::basic_string<char>::const_iterator (std::__cxx11::basic_string<char>::*)() const noexcept'
a.cc:8:24: note:   mismatched types 'std::tuple<_UTypes ...>' and 'std::__cxx11::basic_string<char>::iterator (std::__cxx11::basic_string<char>::*)() noexcept'
/usr/include/c++/14/tuple: In substitution of 'template<class ... _Elements> typename std::enable_if<(! std::__and_<std::__is_swappable<_Elements>...>::value)>::type std::swap(tuple<_UTypes ...>&, tuple<_UTypes ...>&) [with _Elements = {}]':
a.cc:8:24:   required from here
/usr/include/c++/14/tuple:2823:5: error: no type named 'type' in 'struct std::enable_if<false, void>'
 2823 |     swap(tuple<_Elements...>&, tuple<_Elements...>&) = delete;
      |     ^~~~