题解
【入门】国王
1 条题解
-
0
#include<iostream> #include<cstring> using namespace std; bool mojing(string s,int end)//end下标 { bool f; if((end+1)%2==0){ f=true; for(int i=0;i<=end/2;i++){ if(s[i]!=s[end-i]){ f=false; break; } } } else{ f=false; } return f; } int main(){ string s; cin>>s; int end=s.size()-1; while(mojing(s,end)==true){//满足镜面要求一直循环 end=end/2; } cout<<end+1; return 0; }
- 1