結果
| 問題 | No.1617 Palindrome Removal | 
| コンテスト | |
| ユーザー |  khm_nk | 
| 提出日時 | 2021-07-22 23:13:23 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 442 bytes | 
| コンパイル時間 | 1,656 ms | 
| コンパイル使用メモリ | 168,056 KB | 
| 実行使用メモリ | 7,184 KB | 
| 最終ジャッジ日時 | 2024-07-17 19:58:13 | 
| 合計ジャッジ時間 | 2,758 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 10 WA * 10 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
  string S, s;
  cin >> S;
  int N = S.size();
  for(int i=0; i<N; i++)  s.push_back(S.at(N-1-i));
  int ans=-1;
  
  if(N>1 && N%2==1){
    if(S!=s) ans = S.size();
    else if(N>2) ans = N-2;
      
    else{
      S.erase(S.begin() + (N/2) -1);
      s.erase(s.begin() + (N/2) -1);
       if(S!=s) ans = 0;
    } 
  }
  else if(N>1 && N%2==0) ans=0;
  
  cout << ans << endl;
  
}
            
            
            
        