結果
| 問題 | No.588 空白と回文 | 
| コンテスト | |
| ユーザー |  ugis_prog | 
| 提出日時 | 2018-06-10 00:28:07 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 681 bytes | 
| コンパイル時間 | 628 ms | 
| コンパイル使用メモリ | 65,400 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-06-30 13:06:01 | 
| 合計ジャッジ時間 | 1,434 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 19 WA * 6 | 
ソースコード
#include<iostream>
#include<stack>
#include<string>
#include<algorithm>
using namespace std;
int main(){
    string s;
    cin>>s;
    int ans = -1;
    for(int i=0;i<s.size();i++){
        stack<char> st;
        int count = 0;
        string front = s.substr(i,s.size());
        
        for(int j=front.size()-1;j>0;j--){
            if(front[j] == s[i]) break;
            else front.pop_back(); 
        }
        
        string back = front;
        reverse(front.begin(),front.end());
        for(int j=0;j<front.size();j++){
            if(front[j] == back[j]) count++;
            
        }
        ans = max(ans,count);
        
    }
    cout<<ans<<endl;
}
            
            
            
        