結果

問題 No.342 一番ワロタww
ユーザー HachimoriHachimori
提出日時 2016-02-13 00:00:17
言語 Python2
(2.7.18)
結果
AC  
実行時間 12 ms / 5,000 ms
コード長 785 bytes
コンパイル時間 49 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2024-04-23 13:16:46
合計ジャッジ時間 879 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,272 KB
testcase_01 AC 11 ms
6,272 KB
testcase_02 AC 11 ms
6,272 KB
testcase_03 AC 11 ms
6,272 KB
testcase_04 AC 12 ms
6,272 KB
testcase_05 AC 12 ms
6,272 KB
testcase_06 AC 12 ms
6,272 KB
testcase_07 AC 12 ms
6,272 KB
testcase_08 AC 11 ms
6,144 KB
testcase_09 AC 11 ms
6,272 KB
testcase_10 AC 10 ms
6,144 KB
testcase_11 AC 11 ms
6,144 KB
testcase_12 AC 11 ms
6,144 KB
testcase_13 AC 11 ms
6,272 KB
testcase_14 AC 10 ms
6,272 KB
testcase_15 AC 10 ms
6,144 KB
testcase_16 AC 11 ms
6,144 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