Run ID Author Problem Lang Verdict Time Memory Code Length Submit Time
23787 LeoWang 判断字符串是否为回文 C++ Wrong Answer 0 MS 244 KB 400 2023-07-31 22:07:17

Tests(0/4):


#include<iostream> #include<cstring> using namespace std; int main() { char s[505]; gets(s); int max = 0; int pos = 0; int cnt = 0; for(int i = 0; i < strlen(s); i++){ if(s[i] != ' ' && s[i] != '.'){ cnt++; } else{ if(cnt>max){ max = cnt; pos = i-cnt; } cnt = 0; } } for(int i = pos; i < pos+max; i++){ cout<<s[i]; } return 0; }


Judgement Protocol: