結果
| 問題 |
No.1617 Palindrome Removal
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-07-22 21:22:33 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 390 bytes |
| コンパイル時間 | 1,804 ms |
| コンパイル使用メモリ | 199,240 KB |
| 最終ジャッジ日時 | 2025-01-23 06:00:32 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 18 WA * 2 |
ソースコード
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
string s; cin>>s;
set<char> st;
for(char c:s)st.insert(c);
if(st.size()==1){
if(s.size()%2==0)puts("0");
else puts("-1");
}
else{
string t=s;
reverse(t.begin(),t.end());
if(s==t)cout<<s.size()-2<<endl;
else cout<<s.size()<<endl;
}
}