結果

問題 No.1617 Palindrome Removal
ユーザー shiomusubi496shiomusubi496
提出日時 2021-07-22 21:22:33
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 390 bytes
コンパイル時間 2,062 ms
コンパイル使用メモリ 203,768 KB
実行使用メモリ 5,220 KB
最終ジャッジ日時 2023-09-24 15:23:09
合計ジャッジ時間 3,664 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 22 ms
4,376 KB
testcase_01 AC 23 ms
5,156 KB
testcase_02 AC 23 ms
5,220 KB
testcase_03 AC 23 ms
5,100 KB
testcase_04 AC 27 ms
5,092 KB
testcase_05 AC 21 ms
4,900 KB
testcase_06 AC 51 ms
5,156 KB
testcase_07 AC 31 ms
4,440 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 43 ms
5,104 KB
testcase_11 AC 36 ms
4,924 KB
testcase_12 AC 45 ms
5,152 KB
testcase_13 AC 47 ms
5,176 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
    }
}
0