0
\$\begingroup\$

This question already has an answer here:

Background

The background comes from this related challenge. Thanks, @HeyLlama!

The "Look and say" or "Say what you see" sequence is a series of numbers where each describes the last.

1
11 (one one)
21 (two ones)
1211 (one two, one one)
111221 (one one, one two, two ones)
312211 (three ones, two twos, one one)
and on and on...

Challenge

Given a positive integer with an even number of digits, give the previous number described by the "Look and say" pattern.

You may take input and/or give output as a list of digits rather than numbers.

The given number may not necessarily be part of sequence A005150; this is provided as an example rather than a domain specification.

Test Cases

11 (one 1) -> 1
21 (two 1s) -> 11
131112 (one 3, one 1, one 2) -> 312
234186 (two 3s, four 1s, eight 6s) -> 33111166666666

Scoring

This is , so the shortest answer in each language wins!

\$\endgroup\$

marked as duplicate by Leaky Nun code-golf Jul 7 '17 at 5:04

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • \$\begingroup\$ Feel free to comment below why you think this isn't a duplicate, and I'll gladly remove my dupehammer. \$\endgroup\$ – Leaky Nun Jul 7 '17 at 5:05
  • \$\begingroup\$ @LeakyNun Looks to be a dupe except the order is reversed and this one is restricted to numbers. If any algorithm can use maths instead of splitting the number it might be enough to not be a dupe. But I don't know if that is the case here. \$\endgroup\$ – TheLethalCoder Jul 7 '17 at 10:29