41. Look and Say

The knock that morning was unlike Johann’s usual arrival — three quiet taps, and then a pause.

He entered still wearing the previous evening’s coat, unshaven, and looked at Mihkel for a long moment before speaking.

„I had a dream,“ he said. „And you were in it. Not quite. But you were.“

He told it then — the corridors, the doors that would not yield, the small cold keys, the certainty of Mihkel’s unseen presence guiding him through a place that answered only to rule.

„It was foolish, of course. And yet I could not shake it. You were not in the maze, Mihkel. You were above it. As though you saw the whole while I stumbled inside a part.“

Mihkel said nothing for a long while.

He had known for some time that Johann half-knew. The quiet remarks after the candles, the „you always find it“ at the printing house, the careful way Johann had stopped asking how. A friend who notices and refrains from pressing is carrying a secret of his own — the secret of not having been told.

And now Johann had come not with his usual pomp but with a dream in which Mihkel, unseen, had guided him by rule. To deny it now would be the first real lie Mihkel had ever told him.

He rose, closed the outer door, and drew the shutter across the window.

„Johann. There is something I must show you.“

He led him into the workshop and drew back the canvas.

Johann walked a slow circle around the Logic Mill, touched nothing, and finally stopped.

„How does it…“

„Let me show you with something you already brought me,“ Mihkel said.

He took a strip of tape and assigned the symbols of the dream: a door as 1, a corridor as 2, a key as 3. „Three doors. Two corridors. One key.“ He marked them as Johann had walked them, and fed the tape to the Mill.

„It will not interpret. It will only look, and group what is alike, and say back how many and of what.“

The mechanism began its measured work.

On the input tape, you'll get a sequence of decimal digits (0-9). Your task is to write its next look-and-say term: replace each consecutive group of equal digits with count followed by digit.

Count is always in the range 1-9, so the input will never contain more than 9 equal digits in a row.

For example, if the input tape is 111221, the output tape should be 312211: three 1s, then two 2s, then one 1. More examples: 111, 211211, 1001112011.

Sign in to submit your solution.

Quest leaderboard
Discuss it on Reddit or Discord
This was the last quest for now.
Get updates about new quests by subscribing to the social media channels or RSS