結果

問題 No.345 最小チワワ問題
ユーザー gya9_
提出日時 2018-07-19 19:11:38
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 325 bytes
コンパイル時間 127 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-12-24 07:24:03
合計ジャッジ時間 2,253 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 RE * 1
other AC * 3 WA * 3 RE * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

S = input()

cpos = [i for i, x in enumerate(S) if x == "c"]

wpos = [i for i, x in enumerate(S) if x == "w"]

ans = -1

if len(cpos) == 0 or len(wpos) <= 1:
    print(-1)
    sys.exit()

for i in cpos:
    wpostemp = [j for j in wpos if j > i]

    if ans < wpostemp[1] - i + 1:
        ans = wpostemp[1] - i + 1

print(ans)
0