結果
| 問題 |
No.1617 Palindrome Removal
|
| コンテスト | |
| ユーザー |
nok0
|
| 提出日時 | 2021-07-06 18:18:25 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 290 bytes |
| コンパイル時間 | 2,869 ms |
| コンパイル使用メモリ | 193,624 KB |
| 最終ジャッジ日時 | 2025-01-22 17:50:24 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 18 WA * 2 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
int n = s.size();
int k = count(s.begin(), s.end(), s[0]);
if(n == k)
puts(n & 1 ? "-1" : "0");
else {
if(s == string{s.rbegin(), s.rend()})
cout << n - 2 << endl;
else
cout << n << endl;
}
}
nok0