結果

問題 No.342 一番ワロタww
ユーザー 🍡yurahuna🍡yurahuna
提出日時 2016-02-12 23:09:16
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 877 bytes
コンパイル時間 520 ms
コンパイル使用メモリ 11,928 KB
実行使用メモリ 10,128 KB
最終ジャッジ日時 2023-10-22 03:26:07
合計ジャッジ時間 1,409 ms
ジャッジサーバーID
(参考情報)
judge10 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

s = input()
n = len(s)

if s.count('w') == n:
    print('')
    exit()

li = [0] * n
ma = 0
flag = False
cnt = 0
for i in range(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
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