Language: C++

#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
char s;
long long ans=1<<30; 
int main(){
    cin>>s;
    for(int i=1;i<strlen(s);i++)
        if(s[i]!=s[i-1])
            ans=min(ans,max(i,int(strlen(s))-i));
    printf("%d\n",min(ans,int(strlen(s))));
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:26: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
    9 |     for(int i=1;i<strlen(s);i++)
      |                          ^
      |                          |
      |                          char
In file included from /usr/include/c++/14/cstring:43,
                 from a.cc:2:
/usr/include/string.h:407:35: note:   initializing argument 1 of 'size_t strlen(const char*)'
  407 | extern size_t strlen (const char *__s)
      |                       ~~~~~~~~~~~~^~~
a.cc:10:13: error: invalid types 'char[int]' for array subscript
   10 |         if(s[i]!=s[i-1])
      |             ^
a.cc:10:19: error: invalid types 'char[int]' for array subscript
   10 |         if(s[i]!=s[i-1])
      |                   ^
a.cc:11:42: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   11 |             ans=min(ans,max(i,int(strlen(s))-i));
      |                                          ^
      |                                          |
      |                                          char
/usr/include/string.h:407:35: note:   initializing argument 1 of 'size_t strlen(const char*)'
  407 | extern size_t strlen (const char *__s)
      |                       ~~~~~~~~~~~~^~~
a.cc:11:20: error: no matching function for call to 'min(long long int&, const int&)'
   11 |             ans=min(ans,max(i,int(strlen(s))-i));
      |                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 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/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:11:20: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   11 |             ans=min(ans,max(i,int(strlen(s))-i));
      |                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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
a.cc:12:38: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   12 |     printf("%d\n",min(ans,int(strlen(s))));
      |                                      ^
      |                                      |
      |                                      char
/usr/include/string.h:407:35: note:   initializing argument 1 of 'size_t strlen(const char*)'
  407 | extern size_t strlen (const char *__s)
      |                       ~~~~~~~~~~~~^~~
a.cc:12:22: error: no matching function for call to 'min(long long int&, int)'
   12 |     printf("%d\n",min(ans,int(strlen(s))));
      |                   ~~~^~~~~~~~~~~~~~~~~~~~
/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:12:22: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   12 |     printf("%d\n",min(ans,int(strlen(s))));
      |                   ~~~^~~~~~~~~~~~~~~~~~~~
/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