結果

問題 No.342 一番ワロタww
ユーザー norioc
提出日時 2024-07-17 01:55:47
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 550 bytes
コンパイル時間 418 ms
コンパイル使用メモリ 82,452 KB
実行使用メモリ 64,968 KB
最終ジャッジ日時 2024-07-17 01:55:50
合計ジャッジ時間 2,076 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 3 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

import re

S = input()

w = 'w'
while S and S[0] == w:
    S = S[1:]

reg = re.compile('^[^w]+w+')
s = S
cands = []
while m := reg.match(s):
    t = m.group(0)
    if t[0] != w:
        cands.append(t)
    s = s[len(t):]


def count_w(s: str) -> int:
    for i in reversed(range(len(s))):
        if s[i] != w:
            return len(s) - i

    assert False


xs = [(s, count_w(s)) for s in cands]
if not xs:
    print()
    exit()

_, max_wcnt = max(xs, key=lambda x: x[1])
for s, wcnt in xs:
    if wcnt == max_wcnt:
        print(s[:wcnt])
0