結果

問題 No.345 最小チワワ問題
ユーザー yumechi
提出日時 2016-03-03 06:47:04
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 265 bytes
コンパイル時間 390 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-09-25 11:36:18
合計ジャッジ時間 2,272 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

s = input()
res = 114
while "c" in s:
    cidx = s.find("c")
    widx = s.find("w", cidx+1)
    if widx < 0:
        break
    w2idx = s.find("w", widx+1)
    if w2idx > 0:
        res = min(res, w2idx - cidx + 1)
    s = s[cidx+1:]
print(res if res != 114 else -1)
0