結果

問題 No.342 一番ワロタww
ユーザー HachimoriHachimori
提出日時 2016-02-13 00:00:17
言語 Python2
(2.7.18)
結果
AC  
実行時間 10 ms / 5,000 ms
コード長 785 bytes
コンパイル時間 73 ms
コンパイル使用メモリ 6,600 KB
実行使用メモリ 5,988 KB
最終ジャッジ日時 2023-08-05 16:07:36
合計ジャッジ時間 947 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
5,936 KB
testcase_01 AC 9 ms
5,920 KB
testcase_02 AC 10 ms
5,988 KB
testcase_03 AC 10 ms
5,912 KB
testcase_04 AC 10 ms
5,924 KB
testcase_05 AC 9 ms
5,940 KB
testcase_06 AC 9 ms
5,852 KB
testcase_07 AC 9 ms
5,936 KB
testcase_08 AC 9 ms
5,928 KB
testcase_09 AC 9 ms
5,924 KB
testcase_10 AC 9 ms
5,880 KB
testcase_11 AC 10 ms
5,972 KB
testcase_12 AC 9 ms
5,920 KB
testcase_13 AC 9 ms
5,856 KB
testcase_14 AC 10 ms
5,944 KB
testcase_15 AC 9 ms
5,920 KB
testcase_16 AC 10 ms
5,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python
#coding:utf8

def read():
    return raw_input().decode('utf-8')


def work(s):
    ansList = []
    maxLeng = 0
    idx = len(s) - 1
    
    while idx >= 0:
        cnt = 0
        while idx >= 0 and s[idx] == 'w'.decode('utf-8'):
            cnt += 1
            idx -= 1

        toPush = ''
        while idx >= 0 and s[idx] != 'w'.decode('utf-8'):
            toPush += s[idx]
            idx -= 1
        toPush = toPush[::-1].encode('utf-8')    

        if cnt == 0 or len(toPush) == 0:
            continue
        
        if maxLeng < cnt:
            ansList = [toPush]
            maxLeng = cnt
        elif maxLeng == cnt:
            ansList.append(toPush)

    print "\n".join(ansList[::-1])

    
if __name__ == "__main__":
    work(read())
0