Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
97543 任斌 31回文字符串II C++ Accepted 1 MS 280 KB 418 2024-11-16 10:43:06

Tests(10/10):


Code:

#include<bits/stdc++.h> using namespace std; string a; bool hws(int l,int n){ int len=(n-l+1)/2; for(int i=0;i<len;i++){ if(a[i+l] != a[n-i]){ return false; } } return true; } int main() { cin>>a; int len=a.length(); for(int i=0;i<len-1;i++){ for(int j=len-1;j>i;j--){ if(hws(i,j)&& (j-i)!=1){ cout<<"Yes"<<endl; return 0; } } } cout<<"No"; return 0; }