結果
| 問題 |
No.1617 Palindrome Removal
|
| コンテスト | |
| ユーザー |
brthyyjp
|
| 提出日時 | 2021-07-24 16:22:24 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 112 ms / 2,000 ms |
| コード長 | 316 bytes |
| コンパイル時間 | 292 ms |
| コンパイル使用メモリ | 82,816 KB |
| 実行使用メモリ | 106,324 KB |
| 最終ジャッジ日時 | 2024-07-19 22:20:06 |
| 合計ジャッジ時間 | 3,431 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 |
ソースコード
s = list(str(input()))
n = len(s)
flag = True
for i in range(n//2):
if s[i] != s[n-1-i]:
flag = False
break
if not flag:
print(n)
exit()
if len(set(s)) == 1:
if n%2 == 1:
print(-1)
else:
print(0)
else:
if n == 3:
print(-1)
else:
print(n-2)
brthyyjp