Skip to content

Instantly share code, notes, and snippets.

View t-shinkai00's full-sized avatar
🐶

Takahiro Shinkai t-shinkai00

🐶
  • Japan
  • 22:27 (UTC +09:00)
View GitHub Profile
@t-shinkai00
t-shinkai00 / compress.py
Last active August 16, 2023 16:48
raksul-codegolf
from itertools import groupby
def run_length(logo):
res = []
for line in logo.splitlines():
compressed = [(key, len(list(group))) for key, group in groupby(line)]
res.append(compressed)
return res