結果

問題 No.342 一番ワロタww
ユーザー NagisaNagisa
提出日時 2016-02-13 07:42:57
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 18 ms / 5,000 ms
コード長 1,027 bytes
コンパイル時間 86 ms
コンパイル使用メモリ 10,784 KB
実行使用メモリ 8,240 KB
最終ジャッジ日時 2023-08-05 16:13:04
合計ジャッジ時間 1,276 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,172 KB
testcase_01 AC 17 ms
7,876 KB
testcase_02 AC 16 ms
7,884 KB
testcase_03 AC 16 ms
7,884 KB
testcase_04 AC 16 ms
7,944 KB
testcase_05 AC 17 ms
7,884 KB
testcase_06 AC 16 ms
7,896 KB
testcase_07 AC 16 ms
7,788 KB
testcase_08 AC 17 ms
7,812 KB
testcase_09 AC 17 ms
7,836 KB
testcase_10 AC 17 ms
7,944 KB
testcase_11 AC 17 ms
7,840 KB
testcase_12 AC 17 ms
7,896 KB
testcase_13 AC 17 ms
7,848 KB
testcase_14 AC 17 ms
8,240 KB
testcase_15 AC 17 ms
8,192 KB
testcase_16 AC 16 ms
7,892 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
S = str(input())

ans = 0
temp = 0
st = 0
while S[st] == "w":
    st += 1
    if st == len(S):
        break
for k in range(st,len(S)):
    if S[k] == "w" and S[k-1] != "w":
        temp = 1
    elif S[k] == S[k-1] == "w":
        temp += 1
    else:
        temp = 0
    ans = max(ans,temp)

if ans == 0:
    print("")
    exit()

kotae = []
S = S[::-1]

if S[0] == "w":
    temp = 1
else:
    temp = 0
for k in range(1,len(S)):
    if S[k] == "w" and S[k-1] == "w":
        temp += 1
    elif S[k] != "w" and S[k-1] == "w" and temp == ans:
        st = k
        ed = k+1
    elif S[k] != "w" and S[k-1] != "w" and temp == ans:
        ed += 1
    elif S[k] == "w" and S[k-1] != "w" and temp == ans:
        kotae.append(S[st:ed])
        temp = 1
    elif S[k] == "w" and S[k-1] != "w":
        temp = 1
if temp == ans and S[len(S)-1] != "w":
    kotae.append(S[st:ed])


kotae = reversed(kotae)
if kotae:
    for words in kotae:
        print(words[::-1])
else:
    print("")
0