結果

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

ソースコード

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);
  }
  cout << n - 2 << '\n';
}
0