結果

問題 No.342 一番ワロタww
ユーザー Mr.Fuku
提出日時 2018-08-11 11:41:39
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 30 ms / 5,000 ms
コード長 767 bytes
コンパイル時間 105 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-10-15 13:38:35
合計ジャッジ時間 1,324 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

s = input()
max_word = [""]

def cntw():
    global max_word
    max_cnt = 0
    cnt = 0
    i = len(s)-1
    while i>=0:
        if s[i]=="w":
            while s[i]=="w":
                cnt+=1
                i-=1
                if i<0:
                    return
            if cnt>=max_cnt:
                stock = ""
                while s[i]!="w":
                    stock = s[i] + stock
                    i-=1
                    if i<0:
                        break
                if cnt==max_cnt:
                    max_word.append(stock)
                else:
                    max_cnt=cnt
                    max_word = [stock]
            cnt=0
        else:
            i-=1

cntw()
max_word.reverse()
for ans in max_word:
    print(ans)
0