You have battled some fierce rivals for your spot in the 2019 code in the dark final, however to collect your prize and unlock a year of bragging rights you must solve the puzzle. It's simple enough to do, but can you manage it under pressure... with everyone watching...

To solve this problem you have to review a sequence of digits and find the sum of all digits that match the next digit in the list. The list is circular, so the digit after the last digit is the first digit in the list

For example:

To solve this you must link it with the form below which will allow a user to test any series of numbers that match this pattern. You must also print the resulting sum in the #result element. The example we have provided you is a test case, the real digits will be tested when the first 3 contestants are confident they have solved it and have stopped coding.

You have 15 minutes to work on a solution to this problem. If less than 3 contestants have solved it by the end of the timer we will allow an additional 5 minutes.

The winner is whoever solves it fastest! So if you're confident you have solved it raise your hand and stop coding!

What is the solution?

Good luck!