+
+ $row{-query} = eval {
+ my @query = map { ord } sort @{$chars};
+ my $i = 0;
+ while ($i < @query) {
+ my $j = $i + 1;
+ my $v = $query[$i];
+ while ($j < @query) {
+ $v++;
+ last if $query[$j] != $v;
+ $j++;
+ }
+ if ($j - $i > 2) {
+ splice(@query, $i, $j - $i, "$query[$i]-$query[$j-1]");
+ }
+ $i++;
+ }
+ return join '+', @query;
+ };