Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
fstring & groupby solution in Clear category for Count And Say by dan_rue
from itertools import groupby
def count_and_say(digits: str) -> str:
return "".join(f"{len([*group])}{key}" for key, group in groupby(digits))
April 7, 2024