Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
50213 | jiabokai | 练70.2 判断字符串是否为回文 | C++ | No Test Data | 0 MS | 0 KB | 303 | 2024-08-14 17:50:37 |
#include<bits/stdc++.h> using namespace std; bool palindrome(string s){ int i=0,j=s.size()-1; while(i<=j){ if(s[i]==s[j]){ i++; j--; }else return false; } return true; } int main() { string s; cin>>s; if(palindrome(s)){ cout<<"yes"; }else cout<<"no"; return 0; }