Language: C++

#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int ans=1<<30;
char s;
int main(){
    cin>>s;
    for(int i=1;i<strlen(s);i++)
        if(s[i]!=s[i-1])
            ans=min(ans,max(i,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:38: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   11 |             ans=min(ans,max(i,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:28: error: no matching function for call to 'max(int&, size_t)'
   11 |             ans=min(ans,max(i,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:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:11:28: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'size_t' {aka 'long unsigned int'})
   11 |             ans=min(ans,max(i,strlen(s)-i));
      |                         ~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303: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)
      |                       ~~~~~~~~~~~~^~~