結果

問題 No.345 最小チワワ問題
ユーザー Yuta
提出日時 2023-03-10 11:45:01
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 765 bytes
コンパイル時間 88 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-09-18 03:14:17
合計ジャッジ時間 2,027 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 RE * 1
other AC * 21 RE * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

sentence = input()
# print(sentence)
x,y,z = [0,0,0]
minimal_length = []

for i, string_ in enumerate(sentence):
    if sentence[i] == "c":

        x = i
        y = 0
        for i, string_ in enumerate(sentence):
            if sentence[i] == "w" and i>x:
                if y == 0:
                    y = i
                    
                else:
                    z = i

                    q = z-x+1
                    minimal_length.append(q)
                    break


print(min(minimal_length))

                    
                
            

    #     if sentence[i] == "w":
    #         if y == 0:
    #             y = i
    #         elif z == 0:
    #             z = i
    
#if x != 0 and y != 0 and z!=0:
#a = z-x+1


# print(x,y,z)


0