結果
| 問題 |
No.1617 Palindrome Removal
|
| コンテスト | |
| ユーザー |
山D
|
| 提出日時 | 2021-07-29 18:37:17 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 492 bytes |
| コンパイル時間 | 875 ms |
| コンパイル使用メモリ | 67,508 KB |
| 最終ジャッジ日時 | 2025-01-23 10:11:04 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 3 |
| other | AC * 1 WA * 19 |
ソースコード
#include<iostream>
#include<string>
using namespace std;
#define rep(i,s,n) for (int i=s;i<n;i++)
int main(){
string S;cin>>S;
int n=S.length()-1;
int bef=S[0];
bool kaibun=true,same=true;
rep(i,0,n/2){
if(S[i]!=S[n-i]){
kaibun=same=false;
break;
}
if(bef!=S[i] || bef!=S[n-i]){
same=false;
}
bef=S[i];
}
if((n%2)&&bef!=S[n/2+1])same=false;
if(same){
cout<<0;
}else if(kaibun){
cout<<n-2;
}else{
cout<<n;
}cout<<endl;
}
山D