为啥报错啊

B4039 [GESP202409 三级] 回文拼接

PYC42 @ 2024-12-28 12:13:41

#include<bits/stdc++.h>
using namespace std;
bool huwenchupanduan(string s){
    int len=s.length();
    for(int i=0;i<len/2;i++){
        if(s[i]!=s[len-i]){
            return false;
        }
        return false;
    }
}
int main(){
    int t;
    cin>>t;
for(int j=0;j<t;j++){
    string s;
    cin>>s;
    int len=s.length();

    for(int i=2;i<len-2;i++){
        string s1=s.substr(0,i);
        string s1=s.substr(i);
        if(huwenchupanduan(s1)&&huwenchupanduan(s2)){
            cout<<"Yes"<<endl
        }
        else{
            cout<<"No"<<endl
        }
    }
}
    return 0;
}

include<bits/stdc++.h>

using namespace std; bool huwenchupanduan(string s){ int len=s.length(); for(int i=0;i<len/2;i++){ if(s[i]!=s[len-i]){ return false; } return false; } } int main(){ int t; cin>>t; for(int j=0;j<t;j++){ string s; cin>>s; int len=s.length();

for(int i=2;i<len-2;i++){
    string s1=s.substr(0,i);
    string s1=s.substr(i);
    if(huwenchupanduan(s1)&&huwenchupanduan(s2)){
        cout<<"Yes"<<endl
    }
    else{
        cout<<"No"<<endl
    }
}

} return 0; }


by PYC42 @ 2024-12-28 12:14:17

为啥报错


by yuanhaoran1024 @ 2024-12-28 12:33:55

CE?


by zzhengxi @ 2025-01-01 11:17:22

@PYC42 分号!


by PYC42 @ 2025-01-11 08:36:09

@[zzhengxi]报错的地方不是这里string s1=.subst(i)这一行报错了(下面纯属粗心)


|