結果

問題 No.342 一番ワロタww
コンテスト
ユーザー norioc
提出日時 2024-07-17 01:38:03
言語 PyPy3
(7.3.23)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 56 ms / 5,000 ms
+ 262µs
コード長 462 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 223 ms
コンパイル使用メモリ 96,232 KB
実行使用メモリ 79,328 KB
最終ジャッジ日時 2026-08-14 22:48:01
合計ジャッジ時間 2,541 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

S = input()

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

max_wcnt = 0
cands = []
p = 0
while (q := S.find(w, p)) != -1:
    i = q
    while i < len(S) and S[i] == w:
        i += 1

    if i-q > max_wcnt:
        max_wcnt = i-q
        cands.clear()
    if i-q == max_wcnt:
        cands.append(q)

    p = i

for i in cands:
    p = i-1
    res = []
    while p >= 0 and S[p] != w:
        res.append(S[p])
        p -= 1

    print(''.join(reversed(res)))
0