結果

問題 No.345 最小チワワ問題
ユーザー morina8823
提出日時 2016-03-23 00:05:05
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 800 bytes
コンパイル時間 645 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-01 15:16:04
合計ジャッジ時間 2,268 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 21 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

start = 0
result = 100

input_str = raw_input('')

def search_cww(string, start):
    cww_str = "cww"

    cww_cnt = 0
    str_cnt = 0
    for i in range(start, len(string)):
        if string[i] == cww_str[cww_cnt]: 
            if cww_cnt == 0:
                c_position = i

            str_cnt += 1
#            print("cww_cnt", cww_cnt)
#            print("str_cnt", str_cnt)
            if cww_cnt >= 2:
                return c_position, str_cnt
            cww_cnt += 1
        else:
            if cww_cnt > 0:
                str_cnt += 1
    return -1, -1

while True:
    start, cnt = search_cww(input_str, start)
#    print("start:", start)
#    print("cnt:", cnt)
    start += 1
    if cnt < 0:
        break
    else:
        if result > cnt:
            result = cnt

print(result)
0