結果
問題 | No.588 空白と回文 |
ユーザー | ugis_prog |
提出日時 | 2018-06-10 00:54:11 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 284 ms / 2,000 ms |
コード長 | 832 bytes |
コンパイル時間 | 639 ms |
コンパイル使用メモリ | 67,048 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-30 13:06:54 |
合計ジャッジ時間 | 2,367 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
#include<iostream>#include<string>#include<vector>#include<algorithm>using namespace std;int main(){string s;cin>>s;int ans = -1;for(int i=0;i<s.size();i++){vector<string> subs;string front = s.substr(i,s.size());for(int j=0;j<front.size();j++){if(s[i] == front[j]){string str = front.substr(0,j+1);subs.push_back(str);}}for(int j=0;j<subs.size();j++){int count = 0;string back = subs[j];front = subs[j];reverse(back.begin(),back.end());for(int k=0;k<front.size();k++){if(front[k] == back[k]) count++;}ans = max(ans,count);}}cout<<ans<<endl;}