标签:c++
题目链接:
代码:
#include<iostream> #include<cstdio> #include<cstring> using namespace std; char str[1000105]; int fast() { int start,endd,len,ans=0; for(int i=1;str[i];i++) { start=endd=i; while(str[i]==str[endd+1]) endd++; i=endd; while(str[start-1]==str[endd+1]) start--,endd++; len=endd-start+1; if(len>ans) ans=len; } return ans; } int main() { int n; scanf("%d",&n); while(n--) { str[0]='!'; scanf("%s",str+1); cout<<fast()<<endl; } return 0; }
标签:c++
原文地址:http://blog.csdn.net/axuan_k/article/details/45971771