結果

問題 No.345 最小チワワ問題
ユーザー R N
提出日時 2020-10-12 21:36:05
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 435 bytes
コンパイル時間 80 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-07-20 18:12:43
合計ジャッジ時間 2,023 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 16 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding=utf-8:

import re

s = str(input())
if "cww" in s:
    print(3)
elif "cww" not in s:
    print(-1)
elif len(s) < 3:
    print(-1)
elif len(s) >= 4:
    c = re.compile(r'.*c.*w.*w')
    countList = list()
    for i in range(len(s)):
        temp1 = re.search(c, s[i:])
        if temp1 != None:
            temp2 = temp1.group()
            countList.append(len(temp2))
        else:
            break
    print(min(countList))
0