Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){

  string S;
  cin >> S;
  
  string T = reverse(S.begin(),S.end());
  
  if(S == T) ans++;
  int N = S.size();
  
  string U = reverse(S.begin(),S.end((N - 1)/2));
  if(U == S.substr(S.begin(),S.end((N - 1)/2)) ans ++;
     
     if(ans == 2){
       puts("Yes");
     }else{
       puts("No");
     }
     }
     
  

Compiler output:
a.cc: In function 'int main()':
a.cc:8:21: error: conversion from 'void' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
    8 |   string T = reverse(S.begin(),S.end());
      |              ~~~~~~~^~~~~~~~~~~~~~~~~~~
a.cc:10:14: error: 'ans' was not declared in this scope; did you mean 'abs'?
   10 |   if(S == T) ans++;
      |              ^~~
      |              abs
a.cc:13:37: error: no matching function for call to 'std::__cxx11::basic_string<char>::end(int)'
   13 |   string U = reverse(S.begin(),S.end((N - 1)/2));
      |                                ~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:978:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::iterator std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::end() [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; iterator = std::__cxx11::basic_string<char>::iterator]'
  978 |       end() _GLIBCXX_NOEXCEPT
      |       ^~~
/usr/include/c++/14/bits/basic_string.h:978:7: note:   candidate expects 0 arguments, 1 provided
/usr/include/c++/14/bits/basic_string.h:987:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::const_iterator std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::end() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; const_iterator = std::__cxx11::basic_string<char>::const_iterator]'
  987 |       end() const _GLIBCXX_NOEXCEPT
      |       ^~~
/usr/include/c++/14/bits/basic_string.h:987:7: note:   candidate expects 0 arguments, 1 provided
a.cc:14:35: error: no matching function for call to 'std::__cxx11::basic_string<char>::end(int)'
   14 |   if(U == S.substr(S.begin(),S.end((N - 1)/2)) ans ++;
      |                              ~~~~~^~~~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:978:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::iterator std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::end() [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; iterator = std::__cxx11::basic_string<char>::iterator]'
  978 |       end() _GLIBCXX_NOEXCEPT
      |       ^~~
/usr/include/c++/14/bits/basic_string.h:978:7: note:   candidate expects 0 arguments, 1 provided
/usr/include/c++/14/bits/basic_string.h:987:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::const_iterator std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::end() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; const_iterator = std::__cxx11::basic_string<char>::const_iterator]'
  987 |       end() const _GLIBCXX_NOEXCEPT
      |       ^~~
/usr/include/c++/14/bits/basic_string.h:987:7: note:   candidate expects 0 arguments, 1 provided
a.cc:16:6: error: expected primary-expression before 'if'
   16 |      if(ans == 2){
      |      ^~
a.cc:14:55: error: expected ')' before 'if'
   14 |   if(U == S.substr(S.begin(),S.end((N - 1)/2)) ans ++;
      |     ~                                                 ^
      |                                                       )
   15 | 
   16 |      if(ans == 2){
      |      ~~                                                
a.cc:21:6: error: expected primary-expression before '}' token
   21 |      }
      |      ^