結果
| 問題 | 
                            No.345 最小チワワ問題
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2017-05-04 22:44:00 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 438 bytes | 
| コンパイル時間 | 83 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 10,752 KB | 
| 最終ジャッジ日時 | 2024-09-14 07:17:48 | 
| 合計ジャッジ時間 | 2,083 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 WA * 2 | 
| other | AC * 12 WA * 10 RE * 7 | 
ソースコード
#関数をなるべく使おう
def main():
    s=input()
    flg=0
    pri(s,flg)
def pri(s,flg):
    for i in range(len(s)):
        if s[i]=="c" and s[i+1]=="w" and flg==0:
            f=i
            flg=1
        elif s[i]=="w" and flg==1:
            flg=2
        elif s[i]=="w" and flg==2:
            flg=3
            e=i
    if flg==3:
        print(e-f+1)
    else:
        print(-1)
    
if __name__=="__main__":
    main()