Advent of Code: Day 10
Elves Look, Elves Say

First puzzle

In this puzzle, we need to convert a string of digits to the string of digits counting how many consecutive numbers appears. Yes, it is confusing if you read it that way, but things are going to get more understandable after seeing some examples:

Now things are clearer. The solution to the puzzle is the length of the final string after 40 iterations of this process on the puzzle input.

I have to say the code I wrote with Scala was so slow I am ashamed to show it. It gave me the right answer, but… it took 4 hours!!!! To pass to the next puzzle I wrote it in Javascript, and it gave me result in less than 5 seconds:

After feeling frustrated for a while, I decided to find another idea I could use, and I found this Python code here. It is a brilliant solution using RegEx, and here is the Scala translation:

Second puzzle

The second part of the puzzle it to execute the same, but 50 times instead of 40:

You can find this code along with my input and puzzle answers at here.

*****
Written by Darien Martinez Torres on 10 March 2016