Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  string S; cin>>S;
  long long ans=(S.size()*(S.size()-1))/2
  for(int i=0;i<S.size()-1;j++){
    if(S.at(i)!=S.at(i+1))break;
    else{
      ans--;
      for(int j=0;j<min(i,S.size()-i-1);j++){
        if(S.at(i-j-1)==S.at(i+j+2))ans--;
        else break;
      }
    }
  }
  for(int i=1;i<S.size()-1){
    if(S.at(i-1)!=S.at(i+1))break;
    else{
      ans--;
      for(int j=0;j<min(i-j-1,S.size()-i-1);j++){
        if(S.at(i-j-2)==S.at(i+j+2))ans--;
        else break;
    }
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: expected ',' or ';' before 'for'
    6 |   for(int i=0;i<S.size()-1;j++){
      |   ^~~
a.cc:6:15: error: 'i' was not declared in this scope
    6 |   for(int i=0;i<S.size()-1;j++){
      |               ^
a.cc:6:28: error: 'j' was not declared in this scope
    6 |   for(int i=0;i<S.size()-1;j++){
      |                            ^
a.cc:16:27: error: expected ';' before ')' token
   16 |   for(int i=1;i<S.size()-1){
      |                           ^
      |                           ;
a.cc:20:24: error: no matching function for call to 'min(int, std::__cxx11::basic_string<char>::size_type)'
   20 |       for(int j=0;j<min(i-j-1,S.size()-i-1);j++){
      |                     ~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:20:24: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'})
   20 |       for(int j=0;j<min(i-j-1,S.size()-i-1);j++){
      |                     ~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:20:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   20 |       for(int j=0;j<min(i-j-1,S.size()-i-1);j++){
      |                     ~~~^~~~~~~~~~~~~~~~~~~~
a.cc:26:2: error: expected '}' at end of input
   26 | }
      |  ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^