結果

問題 No.345 最小チワワ問題
ユーザー e
提出日時 2022-05-26 22:17:30
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 365 bytes
コンパイル時間 298 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-09-20 15:07:38
合計ジャッジ時間 2,002 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

s = input()
count = 0
temp = 0
current = ""
for i in range(1, len(s)+1):
    if s[i-1] == "c" and current == "":
        temp = i
        current += "c"
    elif s[i-1] == "w" and current == "c":
        current += "w"
    elif s[i-1] == "w" and current == "cw":
        current += "w"
        temp = (i - temp + 1)
    
print(temp if current == "cww" else -1)
    
0