結果

問題 No.1617 Palindrome Removal
ユーザー risujiroh
提出日時 2021-07-22 21:31:22
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 413 bytes
コンパイル時間 1,970 ms
コンパイル使用メモリ 194,420 KB
最終ジャッジ日時 2025-01-23 06:10:53
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 19 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

int main() {
  using namespace std;
  cin.tie(nullptr)->sync_with_stdio(false);
  string s;
  cin >> s;
  int n = size(s);
  if (count(begin(s), end(s), s[0]) == n) {
    cout << "-1\n";
    exit(0);
  }
  if (s != string(rbegin(s), rend(s))) {
    cout << n << '\n';
    exit(0);
  }
  if (n == 3) {
    cout << "-1\n";
    exit(0);
  }
  cout << n - 2 << '\n';
}
0