
Today
marks 27 years since the "birthday" of one of the most popular programming languages today - Perl. It has created a myriad of applications and Internet resources, including those having multimillion-dollar audiences, and the corresponding financial turnovers. You won't have to go far for examples: Amazon, Yahoo !, Slashdot. The last 20 years, he is among the ten most used languages, despite rumors of his demise. However, the multimillion army of Perl programmers, annually issuing a multitude of products to the surface, convincingly refutes the camelinus innuendoes. As the saying goes, the dog barks - the caravan is coming. Since its introduction in 1987, Perl has nurtured two generations of programmers, and there is no reason to abandon the Pearl Ship of the Desert for at least 30 more years. So we are pleased to congratulate all Perl programmers on their birthday of their “native” language, Larry Wall wish calendar and creative longevity so that he has enough enthusiasm to create a couple more versions of Perl.
We also timed the publication of the decisions of the winners in a small contest of Golf programmers,
announced on October 3 as part of the Moscow.pm meeting, for this wonderful language.
Recall the conditions of the problem:
Find the longest ring that can be made from the list of knuckles offered to you or output 0 if they cannot be looped.')
Input : A string of pairs of numbers from 0 to 6, separated by a space. Each pair is one knuckle.
Example : 01 11 12 22 31 32
Data is submitted to STDIN : cat data | golf.pl
Sample answer : 11 12 22 23 31
The problem solving code should contain as few characters as possible. There were three winners, we have already presented them with prizes, and today we are putting their creations on your court.

Denis Evdokimov (110 characters):
Vitaly Dyatlov (116 characters):
$><<(gets+$/+$_.reverse).split.permutation.map{|b|b*' '=~/(?!.*(.)(.) .*\2\1)(.)((.) \5)*\3/&&$&||?0}.max_by(&:size)
Timur Nozadze (119 characters):
And one more code from P.Ya., who won the audience award: