题解 | #密码截取#
密码截取
https://www.nowcoder.com/practice/3cd4621963e8454594f00199f4536bb1
#include <iostream>
using namespace std;
int main() {
string s1;
getline(cin,s1);
int n1=s1.length();
int num=1;
for(int i=0;i<n1;i++)
{
for(int j=i+1;j<n1;j++)
{
hhh:
if(s1[i]==s1[j])
{
for(int n2=i,n3=j;n2<=n3;n2++,n3--)
{
if(s1[n2]!=s1[n3])
{
j++;
goto hhh;
}
}
if(num<(j-i+1))
num=j-i+1;
}
}
}
cout<<num;
}
// 64 位输出请用 printf("%lld")