結果

問題 No.345 最小チワワ問題
ユーザー sassy
提出日時 2024-04-13 14:52:16
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 739 bytes
コンパイル時間 263 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-10-03 00:08:43
合計ジャッジ時間 2,424 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    str_count = 0
    s = str(input())
    # print(s)
    first_c = s.split("c", 1) # 最初に"c"が出てきた時に、それ以降の文字のカウントをしたい。
    # print(first_c) 
    if len(first_c) == 1:
        print(-1)
    else:
        first_w = first_c[1].split("w", 1)
        str_count += len(first_w[0]) + 1
        # print(first_w)
        if len(first_w) == 1:
            print(-1)
        else:
            second_w = first_w[1].split("w", 1)
            # print(second_w)
            str_count += len(second_w[0]) + 2
            if len(second_w) == 1:
                print(-1)
            else:
                print(str_count)

            
        
    
if __name__ == '__main__':
    main()
0