結果
| 問題 | 
                            No.345 最小チワワ問題
                             | 
                    
| コンテスト | |
| ユーザー | 
                             nbisco
                         | 
                    
| 提出日時 | 2016-08-11 15:12:50 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 34 ms / 2,000 ms | 
| コード長 | 346 bytes | 
| コンパイル時間 | 675 ms | 
| コンパイル使用メモリ | 12,672 KB | 
| 実行使用メモリ | 10,752 KB | 
| 最終ジャッジ日時 | 2024-09-25 11:51:38 | 
| 合計ジャッジ時間 | 2,293 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 29 | 
ソースコード
import sys
S = input()
for i in range(3, len(S)+1):
    for j in range(0, len(S)+1-i):
        subs = S[j:j+i]
        c = subs.find("c")
        w = subs.find("w")
        if c == -1 or w == -1:
            continue
        if c > w:
            continue
        if subs.count("w") >= 2:
            print(i)
            sys.exit(0)
print(-1)
            
            
            
        
            
nbisco