結果
| 問題 | 
                            No.345 最小チワワ問題
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2017-08-11 14:08:28 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 395 bytes | 
| コンパイル時間 | 79 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 10,624 KB | 
| 最終ジャッジ日時 | 2024-10-12 20:35:22 | 
| 合計ジャッジ時間 | 2,164 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 15 WA * 14 | 
ソースコード
# -*- coding: utf-8 -*-
S = input()
l = -1
min_l = 101
state = 0   # 0:c探索中, 1:cセット中, 2:最後のw探索中
for c in S:
    l += 1
    if c == 'c' and state == 0:
        l = 1
        state = 1
    elif c == 'w' and state == 1:
        state = 2
    elif c == 'w' and state == 2:
        state = 0
        min_l = min(min_l, l)
min_l = -1 if min_l==101 else min_l
print(min_l)