結果

問題 No.342 一番ワロタww
ユーザー 🍡yurahuna🍡yurahuna
提出日時 2016-02-12 23:35:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 940 bytes
コンパイル時間 80 ms
コンパイル使用メモリ 11,996 KB
実行使用メモリ 93,988 KB
最終ジャッジ日時 2023-10-22 03:35:52
合計ジャッジ時間 12,535 ms
ジャッジサーバーID
(参考情報)
judge10 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-

s = input()
n = len(s)

if s.count('w') in [0, n]:
    print('')
    exit()

li = [0] * n
ma = 0
flag = False
cnt = 0

i = 0
while i < n and s[i] == 'w':
    i += 1

while i < n:
    if flag and s[i] == 'w':
        cnt += 1
    elif not flag and s[i] == 'w':
        flag = True
        cnt += 1
    elif flag and s[i] != 'w':
        flag = False
        ma = max(ma, cnt)
        li[i-1] = cnt
        cnt = 0

    i += 1


ma = max(ma, cnt)
li[n-1] = cnt

li.reverse()
s = s[::-1]

ans = []
t = ''
flag = False
i = 0

while i < n:
    if flag and s[i] != 'w':
        t += s[i]
        i += 1
        continue

    if flag and s[i] == 'w':
        flag = False
        ans.append(t)
        t = ''

    if li[i] == ma:
        flag = True
        i += ma
        continue

    i += 1

if t != '':
    ans.append(t)

if ans != []:
    for x in ans[::-1]:
        print(x[::-1])
else:
    print('')
0