結果

問題 No.1469 programing
ユーザー tktk_snsn
提出日時 2021-04-11 18:32:42
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 1,823 ms / 3,000 ms
コード長 320 bytes
コンパイル時間 80 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 213,612 KB
最終ジャッジ日時 2024-06-27 13:07:59
合計ジャッジ時間 4,728 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

def RunLengthEncoding(S):
    res = []
    N = len(S)
    i = 0
    while i < N:
        cnt = 1
        while i < N - 1 and S[i] == S[i + 1]:
            cnt += 1
            i += 1
        res.append((S[i], cnt))
        i += 1
    return res


S = RunLengthEncoding(input())
ans = "".join(k for k, v in S)
print(ans)
0