From 63a175f357a49fd05553b3f37e6d1ff506e74b4a Mon Sep 17 00:00:00 2001 From: Bob Lied Date: Mon, 3 Nov 2025 10:51:05 -0600 Subject: task 1 done --- challenge-346/bob-lied/README.md | 8 +-- challenge-346/bob-lied/perl/ch-1.pl | 114 ++++++++++++++++++++++++++++++++++++ challenge-346/bob-lied/perl/ch-2.pl | 76 ++++++++++++++++++++++++ 3 files changed, 194 insertions(+), 4 deletions(-) create mode 100644 challenge-346/bob-lied/perl/ch-1.pl create mode 100644 challenge-346/bob-lied/perl/ch-2.pl diff --git a/challenge-346/bob-lied/README.md b/challenge-346/bob-lied/README.md index ee7721333a..f38a58abd4 100644 --- a/challenge-346/bob-lied/README.md +++ b/challenge-346/bob-lied/README.md @@ -1,5 +1,5 @@ -# Solutions to weekly challenge 345 by Bob Lied +# Solutions to weekly challenge 346 by Bob Lied -## [PWC](https://perlweeklychallenge.org/blog/perl-weekly-challenge-345/) -## [GitHub](https://github.com/boblied/perlweeklychallenge-club/tree/master/challenge-345/bob-lied) -[Blog](https://dev.to/boblied/pwc-345-i-went-to-the-mountains-43i0) +## [PWC](https://perlweeklychallenge.org/blog/perl-weekly-challenge-346/) +## [GitHub](https://github.com/boblied/perlweeklychallenge-club/tree/master/challenge-346/bob-lied) +[Blog](https://dev.to/boblied/) diff --git a/challenge-346/bob-lied/perl/ch-1.pl b/challenge-346/bob-lied/perl/ch-1.pl new file mode 100644 index 0000000000..f84a011408 --- /dev/null +++ b/challenge-346/bob-lied/perl/ch-1.pl @@ -0,0 +1,114 @@ +#!/usr/bin/env perl +# vim:set ts=4 sw=4 sts=4 et ai wm=0 nu: +#============================================================================= +# Copyright (c) 2025, Bob Lied +#============================================================================= +# ch-1.pl Perl Weekly Challenge 346 Task 1 Longest Parenthesis +#============================================================================= +# You are given a string containing only ( and ). +# Write a script to find the length of the longest valid parenthesis. +# Example 1 Input: $str = '(()())' +# Output: 6 +# Valid Parenthesis: '(()())' +# Example 2 Input: $str = ')()())' +# Output: 4 +# Valid Parenthesis: '()()' at positions 1-4. +# Example 3 Input: $str = '((()))()(((()' +# Output: 8 +# Valid Parenthesis: '((()))()' at positions 0-7. +# Example 4 Input: $str = '))))((()(' +# Output: 2 +# Valid Parenthesis: '()' at positions 6-7. +# Example 5 Input: $str = '()(()' +# Output: 2 +# Valid Parenthesis: '()' at positions 0-1 and 3-4. +#============================================================================= + +use v5.42; + + +use Getopt::Long; +my $Verbose = false; +my $DoTest = false; +my $Benchmark = 0; + +GetOptions("test" => \$DoTest, "verbose" => \$Verbose, "benchmark:i" => \$Benchmark); +my $logger; +{ + use Log::Log4perl qw(:easy); + Log::Log4perl->easy_init({ level => ($Verbose ? $DEBUG : $INFO ), + layout => "%d{HH:mm:ss.SSS} %p{1} %m%n" }); + $logger = Log::Log4perl->get_logger(); +} +#============================================================================= + +exit(!runTest()) if $DoTest; +exit( runBenchmark($Benchmark) ) if $Benchmark; + +say longestParen($_) for @ARGV; + +#============================================================================= +sub longestParenSub($str) +{ + while ( $str =~ s/\((x*)\)/x$1x/g ) { } + + use List::Util qw/max/; + return ( max map { length($_) } $str =~ m/x+/g ) // 0; +} +sub longestParen($str) +{ + my @stack = ( -1 ); + my $longest = my $streak = 0; + my $open = 0; + for my ($i, $p) ( indexed split(//, $str) ) + { + if ( $p eq '(' ) + { + push @stack, $i; + } + else { + pop @stack; + if ( @stack ) + { + my $len = $i - $stack[-1]; + $longest = $len if $len > $longest; + } + else + { + push @stack, $i; + } + } + $logger->debug("$p i=$i, longest=$longest, stack=(@stack)"); + } + + return $longest; +} + +sub runTest +{ + use Test2::V0; + + is( longestParen('(()())' ), 6, "Example 1"); + is( longestParen(')()())' ), 4, "Example 2"); + is( longestParen('((()))()(((()'), 8, "Example 3"); + is( longestParen('))))((()(' ), 2, "Example 4"); + is( longestParen('()(()' ), 2, "Example 5"); + is( longestParen(')))))' ), 0, "None )"); + is( longestParen('(((((' ), 0, "None ("); + is( longestParen('))(((' ), 0, "None )("); + is( longestParen('(((((())))))' ), 12, "All"); + + done_testing; +} + +sub runBenchmark($repeat) +{ + use Benchmark qw/cmpthese/; + + my $str = join('', map { int(rand(2)) % 2 ? '(' : ')' } 1..100); + $logger->debug($str); + cmpthese($repeat, { + stack => sub { longestParen($str) }, + subst => sub { longestParenSub($str) }, + }); +} diff --git a/challenge-346/bob-lied/perl/ch-2.pl b/challenge-346/bob-lied/perl/ch-2.pl new file mode 100644 index 0000000000..47abbaa0c6 --- /dev/null +++ b/challenge-346/bob-lied/perl/ch-2.pl @@ -0,0 +1,76 @@ +#!/usr/bin/env perl +# vim:set ts=4 sw=4 sts=4 et ai wm=0 nu: +#============================================================================= +# Copyright (c) 2025, Bob Lied +#============================================================================= +# ch-2.pl Perl Weekly Challenge 346 Task 2 Magic Expression +#============================================================================= +# You are given a string containing only digits and a target integer. +# Write a script to insert binary operators +, - and * between the digits +# in the given string that evaluates to target integer. +# Example 1 Input: $str = "123", $target = 6 +# Output: ("1*2*3", "1+2+3") +# Example 2 Input: $str = "105", $target = 5 +# Output: ("1*0+5", "10-5") +# Example 3 Input: $str = "232", $target = 8 +# Output: ("2*3+2", "2+3*2") +# Example 4 Input: $str = "1234", $target = 10 +# Output: ("1*2*3+4", "1+2+3+4") +# Example 5 Input: $str = "1001", $target = 2 +# Output: ("1+0*0+1", "1+0+0+1", "1+0-0+1", "1-0*0+1", "1-0+0+1", "1-0-0+1") +#============================================================================= + +use v5.42; + + +use Getopt::Long; +my $Verbose = false; +my $DoTest = false; +my $Benchmark = 0; + +GetOptions("test" => \$DoTest, "verbose" => \$Verbose, "benchmark:i" => \$Benchmark); +my $logger; +{ + use Log::Log4perl qw(:easy); + Log::Log4perl->easy_init({ level => ($Verbose ? $DEBUG : $INFO ), + layout => "%d{HH:mm:ss.SSS} %p{1} %m%n" }); + $logger = Log::Log4perl->get_logger(); +} +#============================================================================= + +exit(!runTest()) if $DoTest; +exit( runBenchmark($Benchmark) ) if $Benchmark; + +say '(', join(', ', magic(@ARGV)->@*), ')'; + +#============================================================================= +sub magic($str, $target) +{ + state @OP = ("", "-", "+", "*"); + $logger->debug("@OP"); + my @expr; + return \@expr; +} + +sub runTest +{ + use Test2::V0; + + is( magic("123", 6), ["1*2*3", "1+2+3" ] , "Example 1"); + is( magic("105", 5), ["1*0+5", "10-5" ] , "Example 2"); + is( magic("232", 8), ["2*3+2", "2+3*2" ] , "Example 3"); + is( magic("1234", 10), ["1*2*3+4", "1+2+3+4"] , "Example 4"); + is( magic("1001", 2), ["1+0*0+1", "1+0+0+1", "1+0-0+1", "1-0*0+1", "1-0+0+1", "1-0-0+1"] , "Example 5"); + + done_testing; +} + +sub runBenchmark($repeat) +{ + use Benchmark qw/cmpthese/; + + cmpthese($repeat, { + label => sub { }, + }); +} + -- cgit From 55d1015c1711ec790ed26947879aaea4daa1406b Mon Sep 17 00:00:00 2001 From: Thomas Köhler Date: Mon, 3 Nov 2025 21:49:34 +0100 Subject: Add solution 346. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Thomas Köhler --- challenge-346/jeanluc2020/blog-1.txt | 1 + challenge-346/jeanluc2020/blog-2.txt | 1 + challenge-346/jeanluc2020/perl/ch-1.pl | 96 ++++++++++++++++++++++++++++++++++ challenge-346/jeanluc2020/perl/ch-2.pl | 85 ++++++++++++++++++++++++++++++ 4 files changed, 183 insertions(+) create mode 100644 challenge-346/jeanluc2020/blog-1.txt create mode 100644 challenge-346/jeanluc2020/blog-2.txt create mode 100755 challenge-346/jeanluc2020/perl/ch-1.pl create mode 100755 challenge-346/jeanluc2020/perl/ch-2.pl diff --git a/challenge-346/jeanluc2020/blog-1.txt b/challenge-346/jeanluc2020/blog-1.txt new file mode 100644 index 0000000000..9611c216a2 --- /dev/null +++ b/challenge-346/jeanluc2020/blog-1.txt @@ -0,0 +1 @@ +http://gott-gehabt.de/800_wer_wir_sind/thomas/Homepage/Computer/perl/theweeklychallenge-346-1.html diff --git a/challenge-346/jeanluc2020/blog-2.txt b/challenge-346/jeanluc2020/blog-2.txt new file mode 100644 index 0000000000..cbc2e0b9a8 --- /dev/null +++ b/challenge-346/jeanluc2020/blog-2.txt @@ -0,0 +1 @@ +http://gott-gehabt.de/800_wer_wir_sind/thomas/Homepage/Computer/perl/theweeklychallenge-346-2.html diff --git a/challenge-346/jeanluc2020/perl/ch-1.pl b/challenge-346/jeanluc2020/perl/ch-1.pl new file mode 100755 index 0000000000..0ff6469b41 --- /dev/null +++ b/challenge-346/jeanluc2020/perl/ch-1.pl @@ -0,0 +1,96 @@ +#!/usr/bin/env perl +# https://theweeklychallenge.org/blog/perl-weekly-challenge-346/#TASK1 +# +# Task 1: Longest Parenthesis +# =========================== +# +# You are given a string containing only ( and ). +# +# Write a script to find the length of the longest valid parenthesis. +# +## Example 1 +## +## Input: $str = '(()())' +## Output: 6 +## +## Valid Parenthesis: '(()())' +# +# +## Example 2 +## +## Input: $str = ')()())' +## Output: 4 +## +## Valid Parenthesis: '()()' at positions 1-4. +# +# +## Example 3 +## +## Input: $str = '((()))()(((()' +## Output: 8 +## +## Valid Parenthesis: '((()))()' at positions 0-7. +# +# +## Example 4 +## +## Input: $str = '))))((()(' +## Output: 2 +## +## Valid Parenthesis: '()' at positions 6-7. +# +# +## Example 5 +## +## Input: $str = '()(()' +## Output: 2 +## +## Valid Parenthesis: '()' at positions 0-1 and 3-4. +# +############################################################ +## +## discussion +## +############################################################ +# +# We create all possible substrings and check whether they are +# valid. We keep track of the longest one and return it in the +# end. + +use v5.35; + +longest_parenthesis('(()())'); +longest_parenthesis(')()())'); +longest_parenthesis('((()))()(((()'); +longest_parenthesis('))))((()('); +longest_parenthesis('()(()'); + +sub longest_parenthesis($str) { + say "Input: '$str'"; + my $longest = 0; + my @parts = split //, $str; + foreach my $i (0..$#parts) { + foreach my $j (0..$#parts) { + my $current = join("", @parts[$i..$j]); + if(is_valid($current)) { + my $l = length($current); + $longest = $l if $l > $longest; + } + } + } + say "Output: $longest"; +} + +sub is_valid($str) { + my @parts = split //, $str; + my $open = 0; + foreach my $elem (@parts) { + if($elem eq "(") { + $open++; + } else { + $open--; + } + return 0 if $open < 0; + } + return $open == 0; +} diff --git a/challenge-346/jeanluc2020/perl/ch-2.pl b/challenge-346/jeanluc2020/perl/ch-2.pl new file mode 100755 index 0000000000..3b2c64a496 --- /dev/null +++ b/challenge-346/jeanluc2020/perl/ch-2.pl @@ -0,0 +1,85 @@ +#!/usr/bin/env perl +# https://theweeklychallenge.org/blog/perl-weekly-challenge-346/#TASK2 +# +# Task 2: Magic Expression +# ======================== +# +# You are given a string containing only digits and a target integer. +# +# Write a script to insert binary operators +, - and * between the digits in +# the given string that evaluates to target integer. +# +## Example 1 +## +## Input: $str = "123", $target = 6 +## Output: ("1*2*3", "1+2+3") +# +# +## Example 2 +## +## Input: $str = "105", $target = 5 +## Output: ("1*0+5", "10-5") +# +# +## Example 3 +## +## Input: $str = "232", $target = 8 +## Output: ("2*3+2", "2+3*2") +# +# +## Example 4 +## +## Input: $str = "1234", $target = 10 +## Output: ("1*2*3+4", "1+2+3+4") +# +# +## Example 5 +## +## Input: $str = "1001", $target = 2 +## Output: ("1+0*0+1", "1+0+0+1", "1+0-0+1", "1-0*0+1", "1-0+0+1", "1-0-0+1") +# +############################################################ +## +## discussion +## +############################################################ +# +# We recursively build all possible strings with inserted operators. Then we +# evaluate these strings and keep the ones that calculate to the target. + +use v5.36; + +magic_expression("123", 6); +magic_expression("105", 5); +magic_expression("232", 8); +magic_expression("1234", 10); +magic_expression("1001", 2); + +sub magic_expression($str, $target) { + say "Input: '$str', $target"; + my @parts = split //, $str; + my @result = find_magic_expressions($target, @parts); + say "Output: (\"" . join("\", \"", @result) . "\")"; +} + +sub find_magic_expressions($target, $str, @list) { + my @result = (); + if(@list) { + foreach my $operator ("+", "-", "*", "") { + if($str =~ m/[-+*]0/ && $operator eq "") { + next; + } + my $tmp_str = $str . $operator . $list[0]; + push @result, find_magic_expressions($target, $tmp_str, @list[1..$#list]); + } + } else { + my $x; + eval "\$x = $str;"; + if($x == $target) { + return ($str); + } else { + return (); + } + } + return @result; +} -- cgit From faa472401198ca9cd8988d22d3cc9a3186783378 Mon Sep 17 00:00:00 2001 From: Ali Date: Tue, 4 Nov 2025 08:57:27 +0330 Subject: TWC346 --- challenge-346/deadmarshal/blog.txt | 1 + challenge-346/deadmarshal/elixir/ch1.ex | 36 +++++++++++++++++++++++ challenge-346/deadmarshal/elixir/ch2.ex | 38 ++++++++++++++++++++++++ challenge-346/deadmarshal/go/ch1.go | 43 +++++++++++++++++++++++++++ challenge-346/deadmarshal/go/ch2.go | 45 ++++++++++++++++++++++++++++ challenge-346/deadmarshal/java/Ch1.java | 27 +++++++++++++++++ challenge-346/deadmarshal/java/Ch2.java | 52 +++++++++++++++++++++++++++++++++ challenge-346/deadmarshal/perl/ch-1.pl | 27 +++++++++++++++++ challenge-346/deadmarshal/perl/ch-2.pl | 29 ++++++++++++++++++ 9 files changed, 298 insertions(+) create mode 100644 challenge-346/deadmarshal/blog.txt create mode 100644 challenge-346/deadmarshal/elixir/ch1.ex create mode 100644 challenge-346/deadmarshal/elixir/ch2.ex create mode 100644 challenge-346/deadmarshal/go/ch1.go create mode 100644 challenge-346/deadmarshal/go/ch2.go create mode 100644 challenge-346/deadmarshal/java/Ch1.java create mode 100644 challenge-346/deadmarshal/java/Ch2.java create mode 100644 challenge-346/deadmarshal/perl/ch-1.pl create mode 100644 challenge-346/deadmarshal/perl/ch-2.pl diff --git a/challenge-346/deadmarshal/blog.txt b/challenge-346/deadmarshal/blog.txt new file mode 100644 index 0000000000..49b2fe825f --- /dev/null +++ b/challenge-346/deadmarshal/blog.txt @@ -0,0 +1 @@ +https://deadmarshal.blogspot.com/2025/11/twc346.html diff --git a/challenge-346/deadmarshal/elixir/ch1.ex b/challenge-346/deadmarshal/elixir/ch1.ex new file mode 100644 index 0000000000..d8bb0982a8 --- /dev/null +++ b/challenge-346/deadmarshal/elixir/ch1.ex @@ -0,0 +1,36 @@ +defmodule Ch1 do + @spec longest_parenthesis(s :: String.t()) :: integer + def longest_parenthesis(s) do + s + |> String.graphemes() + |> dp([], 0) + end + + defp dp([], _, result), do: result + + defp dp(["(" | tail], stack, result) do + dp(tail, [0 | stack], result) + end + + defp dp([")" | tail], stack, result) do + {new_stack, new_result} = pop_until(stack, []) + + dp(tail, new_stack, max(result, new_result)) + end + + defp pop_until([], _), do: {[], 0} + + defp pop_until([0 | tail], rest) do + n = List.first(tail) + n = if n, do: n, else: 0 + tail = if n > 0, do: tl(tail), else: tail + result = Enum.sum(rest) + n + 2 + + {[result | tail], result} + end + + defp pop_until([h | tail], rest) do + pop_until(tail, [h | rest]) + end +end + diff --git a/challenge-346/deadmarshal/elixir/ch2.ex b/challenge-346/deadmarshal/elixir/ch2.ex new file mode 100644 index 0000000000..f44e7728e7 --- /dev/null +++ b/challenge-346/deadmarshal/elixir/ch2.ex @@ -0,0 +1,38 @@ +defmodule Ch2 do + @spec magic_expression(num :: String.t(), + target :: integer) :: [String.t()] + def magic_expression(num,target) do + dfs([],num,0,String.length(num),0,0,target,[]) + end + + defp dfs(ans, num, i, len, acc, pre, target, exp) do + if i == len do + if acc == target do + [exp |> Enum.reverse() |> Enum.join() | ans] + else + ans + end + else + i..(len - 1) + |> Enum.reduce_while(ans, fn j, ans -> + if j > i && String.at(num, i) == "0" do + {:halt, ans} + else + e = String.slice(num, i..j) + n = String.to_integer(e) + + if i == 0 do + {:cont, dfs(ans, num, j + 1, len, n, n, target, [e | exp])} + else + {:cont, + ans + |> dfs(num, j + 1, len, acc + n, n, target, [e, "+" | exp]) + |> dfs(num, j + 1, len, acc - n, -n, target, [e, "-" | exp]) + |> dfs(num, j + 1, len, acc - pre + pre * n, pre * n, target, [e, "*" | exp])} + end + end + end) + end + end +end + diff --git a/challenge-346/deadmarshal/go/ch1.go b/challenge-346/deadmarshal/go/ch1.go new file mode 100644 index 0000000000..682f07ad3f --- /dev/null +++ b/challenge-346/deadmarshal/go/ch1.go @@ -0,0 +1,43 @@ +package main + +import ( + "fmt" +) + +func max(a, b int) int { + if a > b { + return a + } + return b +} + +func longestParenthesis(s string) int { + stk := []int{} + start, res := 0, 0 + for i, c := range s { + if c == '(' { + stk = append(stk, i) + } else { + if len(stk) == 0 { + start = i + 1 + } else { + stk = stk[:len(stk)-1] + temp := i - start + 1 + if len(stk) == 0 { + res = max(res, temp) + } else { + res = max(res, i-stk[len(stk)-1]) + } + } + } + } + return res +} + +func main() { + fmt.Println(longestParenthesis("(()())")) + fmt.Println(longestParenthesis(")()())")) + fmt.Println(longestParenthesis("((()))()(((()")) + fmt.Println(longestParenthesis("))))((()(")) + fmt.Println(longestParenthesis("()(()")) +} diff --git a/challenge-346/deadmarshal/go/ch2.go b/challenge-346/deadmarshal/go/ch2.go new file mode 100644 index 0000000000..ff6592c241 --- /dev/null +++ b/challenge-346/deadmarshal/go/ch2.go @@ -0,0 +1,45 @@ +package main + +import ( + "fmt" + "strconv" +) + +func magicExpression(num string, target int) []string { + out := []string{} + var backtrack func(string, string, int, int) + backtrack = func(num, prefix string, val, last int) { + if len(num) == 0 { + if val == target { + out = append(out, prefix) + } + return + } + for i := 1; i <= len(num); i++ { + str := num[:i] + digit, _ := strconv.Atoi(str) + if num[0] == '0' && i != 1 { + continue + } + + if prefix == "" { + backtrack(num[i:], str, digit, digit) + } else { + backtrack(num[i:], prefix+"+"+str, val+digit, digit) + backtrack(num[i:], prefix+"-"+str, val-digit, -digit) + backtrack(num[i:], prefix+"*"+str, val-last+last*digit, + last*digit) + } + } + } + backtrack(num, "", 0, 0) + return out +} + +func main() { + fmt.Println(magicExpression("123", 6)) + fmt.Println(magicExpression("105", 5)) + fmt.Println(magicExpression("232", 8)) + fmt.Println(magicExpression("1324", 10)) + fmt.Println(magicExpression("1001", 2)) +} diff --git a/challenge-346/deadmarshal/java/Ch1.java b/challenge-346/deadmarshal/java/Ch1.java new file mode 100644 index 0000000000..947b1f411e --- /dev/null +++ b/challenge-346/deadmarshal/java/Ch1.java @@ -0,0 +1,27 @@ +import java.util.Stack; + +public class Ch1 { + public static void main(String[] args) { + System.out.println(longest_parenthesis("(()())")); + System.out.println(longest_parenthesis(")()())")); + System.out.println(longest_parenthesis("((()))()(((()")); + System.out.println(longest_parenthesis("))))((()(")); + System.out.println(longest_parenthesis("()(()")); + } + + private static int longest_parenthesis(String s) { + Stack stk = new Stack<>(); + stk.push(-1); + int maxlen = 0; + for(int i = 0; i < s.length(); ++i) { + if(s.charAt(i) == '(') stk.push(i); + else { + stk.pop(); + if(stk.isEmpty()) stk.push(i); + else maxlen = Math.max(maxlen,i-stk.peek()); + } + } + return maxlen; + } +} + diff --git a/challenge-346/deadmarshal/java/Ch2.java b/challenge-346/deadmarshal/java/Ch2.java new file mode 100644 index 0000000000..0890b52b15 --- /dev/null +++ b/challenge-346/deadmarshal/java/Ch2.java @@ -0,0 +1,52 @@ +import java.util.List; +import java.util.ArrayList; + +public class Ch2 { + public static void main(String[] args) { + var s = new Solution(); + System.out.println(s.magic_expression("123",6)); + System.out.println(s.magic_expression("105",5)); + System.out.println(s.magic_expression("232",8)); + System.out.println(s.magic_expression("1324",10)); + System.out.println(s.magic_expression("1001",2)); + } +} + +class Solution { + private List ans; + private String num; + private int target; + + public Solution() { + this.ans = null; + this.num = ""; + this.target = 0; + } + + public List magic_expression(String num,int target) { + ans = new ArrayList<>(); + this.num = num; + this.target = target; + dfs(0,0,0,""); + return ans; + } + + private void dfs(int u, long prev, long curr, String path) { + if(u == num.length()) { + if(curr == target) ans.add(path); + return; + } + for(int i = u; i < num.length(); i++) { + if(i != u && num.charAt(u) == '0') break; + long next = Long.parseLong(num.substring(u,i+1)); + if(u == 0) { + dfs(i+1,next,next,path+next); + } else { + dfs(i+1,next,curr+next,path+"+"+next); + dfs(i+1,-next,curr-next,path+"-"+next); + dfs(i+1,prev*next,curr-prev+prev*next,path+"*"+next); + } + } + } +} + diff --git a/challenge-346/deadmarshal/perl/ch-1.pl b/challenge-346/deadmarshal/perl/ch-1.pl new file mode 100644 index 0000000000..fe6bc716eb --- /dev/null +++ b/challenge-346/deadmarshal/perl/ch-1.pl @@ -0,0 +1,27 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use List::Util qw(max); + +sub longest_parenthesis{ + my @s = split '',$_[0]; + my ($max,@stk) = (0,-1); + foreach my $i(0..$#s) { + if($s[$i] eq '(') {push @stk,$i} + else { + pop @stk; + if(@stk == 0) {push @stk,$i} + else { + $max = max($max,$i - $stk[$#stk]) + } + } + } + $max +} + +printf "%d\n",longest_parenthesis('(()())'); +printf "%d\n",longest_parenthesis(')()())'); +printf "%d\n",longest_parenthesis('((()))()(((()'); +printf "%d\n",longest_parenthesis('))))((()('); +printf "%d\n",longest_parenthesis('()(()'); + diff --git a/challenge-346/deadmarshal/perl/ch-2.pl b/challenge-346/deadmarshal/perl/ch-2.pl new file mode 100644 index 0000000000..fb83b57a5b --- /dev/null +++ b/challenge-346/deadmarshal/perl/ch-2.pl @@ -0,0 +1,29 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Algorithm::Combinatorics qw(variations_with_repetition); +use List::Util qw(mesh); +use Data::Show; + +sub magic_expression{ + my ($str,$target) = @_; + my @ds = split '',$str; + my $it = variations_with_repetition(['+','-',,'*',''],$#ds); + my @res; + while(my $ops = $it->next) { + my $expr = join '',mesh(\@ds,[@$ops,'']); + next if $expr =~ /\b0[0-9]/; + my $eval = $expr =~ s/-/+-/gr; + $eval =~ s/(\d+)\*(\d+)/$1*$2/ge while $eval =~ /\*/; + $eval =~ s/(-?\d+)\+(-?\d+)/$1+$2/ge while $eval =~ /\+/; + push @res,$expr if $eval == $target + } + @res +} + +show magic_expression("123",6); +show magic_expression("105",5); +show magic_expression("232",8); +show magic_expression("1324",10); +show magic_expression("1001",2) + -- cgit From 4b97c30a0f595a03515164c96c2746556b9c8c74 Mon Sep 17 00:00:00 2001 From: Mark Anderson Date: Tue, 4 Nov 2025 07:24:11 +0000 Subject: ch-2.raku grammar improved --- challenge-346/mark-anderson/raku/ch-2.raku | 1299 +++++++++++++++++++++++++++- 1 file changed, 1263 insertions(+), 36 deletions(-) diff --git a/challenge-346/mark-anderson/raku/ch-2.raku b/challenge-346/mark-anderson/raku/ch-2.raku index 60238a8f9d..fd31085299 100644 --- a/challenge-346/mark-anderson/raku/ch-2.raku +++ b/challenge-346/mark-anderson/raku/ch-2.raku @@ -14,31 +14,20 @@ is-deeply magic-expression("1001", 2), ("1+0*0+1", "1+0+0+1", "1+0-0+1", "1-0*0 grammar Calculate { - rule TOP { } - rule add-sub { + % $=<[+-]> } - rule mult { + % '*' } - rule digits { + } + rule TOP { } + rule add { + % '+' } + rule subt { + % '-' } + rule mult { + % '*' } + rule digits { + } } class Actions { - method TOP($/) { make $.made } - method digits($/) { make $/ } - method mult($/) { make [*] $>>.made } - method add-sub($/) - { - my @ops = $>>.Str; - my @vals = $>>.made; - my $result; - - for @vals Z @ops.unshift('+') - { - if .tail eq '+' { $result += .head } - else { $result -= .head } - } - - make $result - } + method TOP ($/) { make $.made } + method add ($/) { make [+] $>>.made } + method subt ($/) { make [-] $>>.made } + method mult ($/) { make [*] $>>.made } + method digits($/) { make $/.UInt } } multi magic-expression($str where *.chars > 7, $target) @@ -54,28 +43,1266 @@ multi magic-expression($str, $target) gather for @partitions[@nums-2]<> -> @p { my @r = @nums.rotor(@p)>>.join; - next if any @r ~~ /^0\d/; + next if any @r ~~ /^0/; for @operators[@p-2]<> -> @o { my $exp = flat roundrobin @r, @o; - take [~] $exp if Calculate.parse($exp, actions => Actions).made == $target + take [~] $exp if Calculate.parse($exp, :actions(Actions)).made == $target } } } =finish + [ -[[[1,1]], -[[1,1,1],[1,2],[2,1]], -[[1,1,1,1],[1,1,2],[1,2,1],[2,1,1],[1,3],[3,1],[2,2]], -[[1,1,1,1,1],[1,1,1,2],[1,1,2,1],[1,2,1,1],[2,1,1,1],[1,1,3],[1,3,1],[3,1,1],[1,2,2],[2,1,2],[2,2,1],[1,4],[4,1],[2,3],[3,2]], -[[1,1,1,1,1,1],[1,1,1,1,2],[1,1,1,2,1],[1,1,2,1,1],[1,2,1,1,1],[2,1,1,1,1],[1,1,1,3],[1,1,3,1],[1,3,1,1],[3,1,1,1],[1,1,2,2],[1,2,1,2],[1,2,2,1],[2,1,1,2],[2,1,2,1],[2,2,1,1],[1,1,4],[1,4,1],[4,1,1],[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1],[1,5],[5,1],[2,2,2],[2,4],[4,2],[3,3]], -[[1,1,1,1,1,1,1],[1,1,1,1,1,2],[1,1,1,1,2,1],[1,1,1,2,1,1],[1,1,2,1,1,1],[1,2,1,1,1,1],[2,1,1,1,1,1],[1,1,1,1,3],[1,1,1,3,1],[1,1,3,1,1],[1,3,1,1,1],[3,1,1,1,1],[1,1,1,2,2],[1,1,2,1,2],[1,1,2,2,1],[1,2,1,1,2],[1,2,1,2,1],[1,2,2,1,1],[2,1,1,1,2],[2,1,1,2,1],[2,1,2,1,1],[2,2,1,1,1],[1,1,1,4],[1,1,4,1],[1,4,1,1],[4,1,1,1],[1,1,2,3],[1,1,3,2],[1,2,1,3],[1,2,3,1],[1,3,1,2],[1,3,2,1],[2,1,1,3],[2,1,3,1],[2,3,1,1],[3,1,1,2],[3,1,2,1],[3,2,1,1],[1,1,5],[1,5,1],[5,1,1],[1,2,2,2],[2,1,2,2],[2,2,1,2],[2,2,2,1],[1,2,4],[1,4,2],[2,1,4],[2,4,1],[4,1,2],[4,2,1],[1,3,3],[3,1,3],[3,3,1],[1,6],[6,1],[2,2,3],[2,3,2],[3,2,2],[2,5],[5,2],[3,4],[4,3]]], - -[[["*"],["+"],["-"]], -[["*","*"],["*","+"],["*","-"],["+","*"],["+","+"],["+","-"],["-","*"],["-","+"],["-","-"]], -[["*","*","*"],["*","*","+"],["*","*","-"],["*","+","*"],["*","+","+"],["*","+","-"],["*","-","*"],["*","-","+"],["*","-","-"],["+","*","*"],["+","*","+"],["+","*","-"],["+","+","*"],["+","+","+"],["+","+","-"],["+","-","*"],["+","-","+"],["+","-","-"],["-","*","*"],["-","*","+"],["-","*","-"],["-","+","*"],["-","+","+"],["-","+","-"],["-","-","*"],["-","-","+"],["-","-","-"]], -[["*","*","*","*"],["*","*","*","+"],["*","*","*","-"],["*","*","+","*"],["*","*","+","+"],["*","*","+","-"],["*","*","-","*"],["*","*","-","+"],["*","*","-","-"],["*","+","*","*"],["*","+","*","+"],["*","+","*","-"],["*","+","+","*"],["*","+","+","+"],["*","+","+","-"],["*","+","-","*"],["*","+","-","+"],["*","+","-","-"],["*","-","*","*"],["*","-","*","+"],["*","-","*","-"],["*","-","+","*"],["*","-","+","+"],["*","-","+","-"],["*","-","-","*"],["*","-","-","+"],["*","-","-","-"],["+","*","*","*"],["+","*","*","+"],["+","*","*","-"],["+","*","+","*"],["+","*","+","+"],["+","*","+","-"],["+","*","-","*"],["+","*","-","+"],["+","*","-","-"],["+","+","*","*"],["+","+","*","+"],["+","+","*","-"],["+","+","+","*"],["+","+","+","+"],["+","+","+","-"],["+","+","-","*"],["+","+","-","+"],["+","+","-","-"],["+","-","*","*"],["+","-","*","+"],["+","-","*","-"],["+","-","+","*"],["+","-","+","+"],["+","-","+","-"],["+","-","-","*"],["+","-","-","+"],["+","-","-","-"],["-","*","*","*"],["-","*","*","+"],["-","*","*","-"],["-","*","+","*"],["-","*","+","+"],["-","*","+","-"],["-","*","-","*"],["-","*","-","+"],["-","*","-","-"],["-","+","*","*"],["-","+","*","+"],["-","+","*","-"],["-","+","+","*"],["-","+","+","+"],["-","+","+","-"],["-","+","-","*"],["-","+","-","+"],["-","+","-","-"],["-","-","*","*"],["-","-","*","+"],["-","-","*","-"],["-","-","+","*"],["-","-","+","+"],["-","-","+","-"],["-","-","-","*"],["-","-","-","+"],["-","-","-","-"]], -[["*","*","*","*","*"],["*","*","*","*","+"],["*","*","*","*","-"],["*","*","*","+","*"],["*","*","*","+","+"],["*","*","*","+","-"],["*","*","*","-","*"],["*","*","*","-","+"],["*","*","*","-","-"],["*","*","+","*","*"],["*","*","+","*","+"],["*","*","+","*","-"],["*","*","+","+","*"],["*","*","+","+","+"],["*","*","+","+","-"],["*","*","+","-","*"],["*","*","+","-","+"],["*","*","+","-","-"],["*","*","-","*","*"],["*","*","-","*","+"],["*","*","-","*","-"],["*","*","-","+","*"],["*","*","-","+","+"],["*","*","-","+","-"],["*","*","-","-","*"],["*","*","-","-","+"],["*","*","-","-","-"],["*","+","*","*","*"],["*","+","*","*","+"],["*","+","*","*","-"],["*","+","*","+","*"],["*","+","*","+","+"],["*","+","*","+","-"],["*","+","*","-","*"],["*","+","*","-","+"],["*","+","*","-","-"],["*","+","+","*","*"],["*","+","+","*","+"],["*","+","+","*","-"],["*","+","+","+","*"],["*","+","+","+","+"],["*","+","+","+","-"],["*","+","+","-","*"],["*","+","+","-","+"],["*","+","+","-","-"],["*","+","-","*","*"],["*","+","-","*","+"],["*","+","-","*","-"],["*","+","-","+","*"],["*","+","-","+","+"],["*","+","-","+","-"],["*","+","-","-","*"],["*","+","-","-","+"],["*","+","-","-","-"],["*","-","*","*","*"],["*","-","*","*","+"],["*","-","*","*","-"],["*","-","*","+","*"],["*","-","*","+","+"],["*","-","*","+","-"],["*","-","*","-","*"],["*","-","*","-","+"],["*","-","*","-","-"],["*","-","+","*","*"],["*","-","+","*","+"],["*","-","+","*","-"],["*","-","+","+","*"],["*","-","+","+","+"],["*","-","+","+","-"],["*","-","+","-","*"],["*","-","+","-","+"],["*","-","+","-","-"],["*","-","-","*","*"],["*","-","-","*","+"],["*","-","-","*","-"],["*","-","-","+","*"],["*","-","-","+","+"],["*","-","-","+","-"],["*","-","-","-","*"],["*","-","-","-","+"],["*","-","-","-","-"],["+","*","*","*","*"],["+","*","*","*","+"],["+","*","*","*","-"],["+","*","*","+","*"],["+","*","*","+","+"],["+","*","*","+","-"],["+","*","*","-","*"],["+","*","*","-","+"],["+","*","*","-","-"],["+","*","+","*","*"],["+","*","+","*","+"],["+","*","+","*","-"],["+","*","+","+","*"],["+","*","+","+","+"],["+","*","+","+","-"],["+","*","+","-","*"],["+","*","+","-","+"],["+","*","+","-","-"],["+","*","-","*","*"],["+","*","-","*","+"],["+","*","-","*","-"],["+","*","-","+","*"],["+","*","-","+","+"],["+","*","-","+","-"],["+","*","-","-","*"],["+","*","-","-","+"],["+","*","-","-","-"],["+","+","*","*","*"],["+","+","*","*","+"],["+","+","*","*","-"],["+","+","*","+","*"],["+","+","*","+","+"],["+","+","*","+","-"],["+","+","*","-","*"],["+","+","*","-","+"],["+","+","*","-","-"],["+","+","+","*","*"],["+","+","+","*","+"],["+","+","+","*","-"],["+","+","+","+","*"],["+","+","+","+","+"],["+","+","+","+","-"],["+","+","+","-","*"],["+","+","+","-","+"],["+","+","+","-","-"],["+","+","-","*","*"],["+","+","-","*","+"],["+","+","-","*","-"],["+","+","-","+","*"],["+","+","-","+","+"],["+","+","-","+","-"],["+","+","-","-","*"],["+","+","-","-","+"],["+","+","-","-","-"],["+","-","*","*","*"],["+","-","*","*","+"],["+","-","*","*","-"],["+","-","*","+","*"],["+","-","*","+","+"],["+","-","*","+","-"],["+","-","*","-","*"],["+","-","*","-","+"],["+","-","*","-","-"],["+","-","+","*","*"],["+","-","+","*","+"],["+","-","+","*","-"],["+","-","+","+","*"],["+","-","+","+","+"],["+","-","+","+","-"],["+","-","+","-","*"],["+","-","+","-","+"],["+","-","+","-","-"],["+","-","-","*","*"],["+","-","-","*","+"],["+","-","-","*","-"],["+","-","-","+","*"],["+","-","-","+","+"],["+","-","-","+","-"],["+","-","-","-","*"],["+","-","-","-","+"],["+","-","-","-","-"],["-","*","*","*","*"],["-","*","*","*","+"],["-","*","*","*","-"],["-","*","*","+","*"],["-","*","*","+","+"],["-","*","*","+","-"],["-","*","*","-","*"],["-","*","*","-","+"],["-","*","*","-","-"],["-","*","+","*","*"],["-","*","+","*","+"],["-","*","+","*","-"],["-","*","+","+","*"],["-","*","+","+","+"],["-","*","+","+","-"],["-","*","+","-","*"],["-","*","+","-","+"],["-","*","+","-","-"],["-","*","-","*","*"],["-","*","-","*","+"],["-","*","-","*","-"],["-","*","-","+","*"],["-","*","-","+","+"],["-","*","-","+","-"],["-","*","-","-","*"],["-","*","-","-","+"],["-","*","-","-","-"],["-","+","*","*","*"],["-","+","*","*","+"],["-","+","*","*","-"],["-","+","*","+","*"],["-","+","*","+","+"],["-","+","*","+","-"],["-","+","*","-","*"],["-","+","*","-","+"],["-","+","*","-","-"],["-","+","+","*","*"],["-","+","+","*","+"],["-","+","+","*","-"],["-","+","+","+","*"],["-","+","+","+","+"],["-","+","+","+","-"],["-","+","+","-","*"],["-","+","+","-","+"],["-","+","+","-","-"],["-","+","-","*","*"],["-","+","-","*","+"],["-","+","-","*","-"],["-","+","-","+","*"],["-","+","-","+","+"],["-","+","-","+","-"],["-","+","-","-","*"],["-","+","-","-","+"],["-","+","-","-","-"],["-","-","*","*","*"],["-","-","*","*","+"],["-","-","*","*","-"],["-","-","*","+","*"],["-","-","*","+","+"],["-","-","*","+","-"],["-","-","*","-","*"],["-","-","*","-","+"],["-","-","*","-","-"],["-","-","+","*","*"],["-","-","+","*","+"],["-","-","+","*","-"],["-","-","+","+","*"],["-","-","+","+","+"],["-","-","+","+","-"],["-","-","+","-","*"],["-","-","+","-","+"],["-","-","+","-","-"],["-","-","-","*","*"],["-","-","-","*","+"],["-","-","-","*","-"],["-","-","-","+","*"],["-","-","-","+","+"],["-","-","-","+","-"],["-","-","-","-","*"],["-","-","-","-","+"],["-","-","-","-","-"]], -[["*","*","*","*","*","*"],["*","*","*","*","*","+"],["*","*","*","*","*","-"],["*","*","*","*","+","*"],["*","*","*","*","+","+"],["*","*","*","*","+","-"],["*","*","*","*","-","*"],["*","*","*","*","-","+"],["*","*","*","*","-","-"],["*","*","*","+","*","*"],["*","*","*","+","*","+"],["*","*","*","+","*","-"],["*","*","*","+","+","*"],["*","*","*","+","+","+"],["*","*","*","+","+","-"],["*","*","*","+","-","*"],["*","*","*","+","-","+"],["*","*","*","+","-","-"],["*","*","*","-","*","*"],["*","*","*","-","*","+"],["*","*","*","-","*","-"],["*","*","*","-","+","*"],["*","*","*","-","+","+"],["*","*","*","-","+","-"],["*","*","*","-","-","*"],["*","*","*","-","-","+"],["*","*","*","-","-","-"],["*","*","+","*","*","*"],["*","*","+","*","*","+"],["*","*","+","*","*","-"],["*","*","+","*","+","*"],["*","*","+","*","+","+"],["*","*","+","*","+","-"],["*","*","+","*","-","*"],["*","*","+","*","-","+"],["*","*","+","*","-","-"],["*","*","+","+","*","*"],["*","*","+","+","*","+"],["*","*","+","+","*","-"],["*","*","+","+","+","*"],["*","*","+","+","+","+"],["*","*","+","+","+","-"],["*","*","+","+","-","*"],["*","*","+","+","-","+"],["*","*","+","+","-","-"],["*","*","+","-","*","*"],["*","*","+","-","*","+"],["*","*","+","-","*","-"],["*","*","+","-","+","*"],["*","*","+","-","+","+"],["*","*","+","-","+","-"],["*","*","+","-","-","*"],["*","*","+","-","-","+"],["*","*","+","-","-","-"],["*","*","-","*","*","*"],["*","*","-","*","*","+"],["*","*","-","*","*","-"],["*","*","-","*","+","*"],["*","*","-","*","+","+"],["*","*","-","*","+","-"],["*","*","-","*","-","*"],["*","*","-","*","-","+"],["*","*","-","*","-","-"],["*","*","-","+","*","*"],["*","*","-","+","*","+"],["*","*","-","+","*","-"],["*","*","-","+","+","*"],["*","*","-","+","+","+"],["*","*","-","+","+","-"],["*","*","-","+","-","*"],["*","*","-","+","-","+"],["*","*","-","+","-","-"],["*","*","-","-","*","*"],["*","*","-","-","*","+"],["*","*","-","-","*","-"],["*","*","-","-","+","*"],["*","*","-","-","+","+"],["*","*","-","-","+","-"],["*","*","-","-","-","*"],["*","*","-","-","-","+"],["*","*","-","-","-","-"],["*","+","*","*","*","*"],["*","+","*","*","*","+"],["*","+","*","*","*","-"],["*","+","*","*","+","*"],["*","+","*","*","+","+"],["*","+","*","*","+","-"],["*","+","*","*","-","*"],["*","+","*","*","-","+"],["*","+","*","*","-","-"],["*","+","*","+","*","*"],["*","+","*","+","*","+"],["*","+","*","+","*","-"],["*","+","*","+","+","*"],["*","+","*","+","+","+"],["*","+","*","+","+","-"],["*","+","*","+","-","*"],["*","+","*","+","-","+"],["*","+","*","+","-","-"],["*","+","*","-","*","*"],["*","+","*","-","*","+"],["*","+","*","-","*","-"],["*","+","*","-","+","*"],["*","+","*","-","+","+"],["*","+","*","-","+","-"],["*","+","*","-","-","*"],["*","+","*","-","-","+"],["*","+","*","-","-","-"],["*","+","+","*","*","*"],["*","+","+","*","*","+"],["*","+","+","*","*","-"],["*","+","+","*","+","*"],["*","+","+","*","+","+"],["*","+","+","*","+","-"],["*","+","+","*","-","*"],["*","+","+","*","-","+"],["*","+","+","*","-","-"],["*","+","+","+","*","*"],["*","+","+","+","*","+"],["*","+","+","+","*","-"],["*","+","+","+","+","*"],["*","+","+","+","+","+"],["*","+","+","+","+","-"],["*","+","+","+","-","*"],["*","+","+","+","-","+"],["*","+","+","+","-","-"],["*","+","+","-","*","*"],["*","+","+","-","*","+"],["*","+","+","-","*","-"],["*","+","+","-","+","*"],["*","+","+","-","+","+"],["*","+","+","-","+","-"],["*","+","+","-","-","*"],["*","+","+","-","-","+"],["*","+","+","-","-","-"],["*","+","-","*","*","*"],["*","+","-","*","*","+"],["*","+","-","*","*","-"],["*","+","-","*","+","*"],["*","+","-","*","+","+"],["*","+","-","*","+","-"],["*","+","-","*","-","*"],["*","+","-","*","-","+"],["*","+","-","*","-","-"],["*","+","-","+","*","*"],["*","+","-","+","*","+"],["*","+","-","+","*","-"],["*","+","-","+","+","*"],["*","+","-","+","+","+"],["*","+","-","+","+","-"],["*","+","-","+","-","*"],["*","+","-","+","-","+"],["*","+","-","+","-","-"],["*","+","-","-","*","*"],["*","+","-","-","*","+"],["*","+","-","-","*","-"],["*","+","-","-","+","*"],["*","+","-","-","+","+"],["*","+","-","-","+","-"],["*","+","-","-","-","*"],["*","+","-","-","-","+"],["*","+","-","-","-","-"],["*","-","*","*","*","*"],["*","-","*","*","*","+"],["*","-","*","*","*","-"],["*","-","*","*","+","*"],["*","-","*","*","+","+"],["*","-","*","*","+","-"],["*","-","*","*","-","*"],["*","-","*","*","-","+"],["*","-","*","*","-","-"],["*","-","*","+","*","*"],["*","-","*","+","*","+"],["*","-","*","+","*","-"],["*","-","*","+","+","*"],["*","-","*","+","+","+"],["*","-","*","+","+","-"],["*","-","*","+","-","*"],["*","-","*","+","-","+"],["*","-","*","+","-","-"],["*","-","*","-","*","*"],["*","-","*","-","*","+"],["*","-","*","-","*","-"],["*","-","*","-","+","*"],["*","-","*","-","+","+"],["*","-","*","-","+","-"],["*","-","*","-","-","*"],["*","-","*","-","-","+"],["*","-","*","-","-","-"],["*","-","+","*","*","*"],["*","-","+","*","*","+"],["*","-","+","*","*","-"],["*","-","+","*","+","*"],["*","-","+","*","+","+"],["*","-","+","*","+","-"],["*","-","+","*","-","*"],["*","-","+","*","-","+"],["*","-","+","*","-","-"],["*","-","+","+","*","*"],["*","-","+","+","*","+"],["*","-","+","+","*","-"],["*","-","+","+","+","*"],["*","-","+","+","+","+"],["*","-","+","+","+","-"],["*","-","+","+","-","*"],["*","-","+","+","-","+"],["*","-","+","+","-","-"],["*","-","+","-","*","*"],["*","-","+","-","*","+"],["*","-","+","-","*","-"],["*","-","+","-","+","*"],["*","-","+","-","+","+"],["*","-","+","-","+","-"],["*","-","+","-","-","*"],["*","-","+","-","-","+"],["*","-","+","-","-","-"],["*","-","-","*","*","*"],["*","-","-","*","*","+"],["*","-","-","*","*","-"],["*","-","-","*","+","*"],["*","-","-","*","+","+"],["*","-","-","*","+","-"],["*","-","-","*","-","*"],["*","-","-","*","-","+"],["*","-","-","*","-","-"],["*","-","-","+","*","*"],["*","-","-","+","*","+"],["*","-","-","+","*","-"],["*","-","-","+","+","*"],["*","-","-","+","+","+"],["*","-","-","+","+","-"],["*","-","-","+","-","*"],["*","-","-","+","-","+"],["*","-","-","+","-","-"],["*","-","-","-","*","*"],["*","-","-","-","*","+"],["*","-","-","-","*","-"],["*","-","-","-","+","*"],["*","-","-","-","+","+"],["*","-","-","-","+","-"],["*","-","-","-","-","*"],["*","-","-","-","-","+"],["*","-","-","-","-","-"],["+","*","*","*","*","*"],["+","*","*","*","*","+"],["+","*","*","*","*","-"],["+","*","*","*","+","*"],["+","*","*","*","+","+"],["+","*","*","*","+","-"],["+","*","*","*","-","*"],["+","*","*","*","-","+"],["+","*","*","*","-","-"],["+","*","*","+","*","*"],["+","*","*","+","*","+"],["+","*","*","+","*","-"],["+","*","*","+","+","*"],["+","*","*","+","+","+"],["+","*","*","+","+","-"],["+","*","*","+","-","*"],["+","*","*","+","-","+"],["+","*","*","+","-","-"],["+","*","*","-","*","*"],["+","*","*","-","*","+"],["+","*","*","-","*","-"],["+","*","*","-","+","*"],["+","*","*","-","+","+"],["+","*","*","-","+","-"],["+","*","*","-","-","*"],["+","*","*","-","-","+"],["+","*","*","-","-","-"],["+","*","+","*","*","*"],["+","*","+","*","*","+"],["+","*","+","*","*","-"],["+","*","+","*","+","*"],["+","*","+","*","+","+"],["+","*","+","*","+","-"],["+","*","+","*","-","*"],["+","*","+","*","-","+"],["+","*","+","*","-","-"],["+","*","+","+","*","*"],["+","*","+","+","*","+"],["+","*","+","+","*","-"],["+","*","+","+","+","*"],["+","*","+","+","+","+"],["+","*","+","+","+","-"],["+","*","+","+","-","*"],["+","*","+","+","-","+"],["+","*","+","+","-","-"],["+","*","+","-","*","*"],["+","*","+","-","*","+"],["+","*","+","-","*","-"],["+","*","+","-","+","*"],["+","*","+","-","+","+"],["+","*","+","-","+","-"],["+","*","+","-","-","*"],["+","*","+","-","-","+"],["+","*","+","-","-","-"],["+","*","-","*","*","*"],["+","*","-","*","*","+"],["+","*","-","*","*","-"],["+","*","-","*","+","*"],["+","*","-","*","+","+"],["+","*","-","*","+","-"],["+","*","-","*","-","*"],["+","*","-","*","-","+"],["+","*","-","*","-","-"],["+","*","-","+","*","*"],["+","*","-","+","*","+"],["+","*","-","+","*","-"],["+","*","-","+","+","*"],["+","*","-","+","+","+"],["+","*","-","+","+","-"],["+","*","-","+","-","*"],["+","*","-","+","-","+"],["+","*","-","+","-","-"],["+","*","-","-","*","*"],["+","*","-","-","*","+"],["+","*","-","-","*","-"],["+","*","-","-","+","*"],["+","*","-","-","+","+"],["+","*","-","-","+","-"],["+","*","-","-","-","*"],["+","*","-","-","-","+"],["+","*","-","-","-","-"],["+","+","*","*","*","*"],["+","+","*","*","*","+"],["+","+","*","*","*","-"],["+","+","*","*","+","*"],["+","+","*","*","+","+"],["+","+","*","*","+","-"],["+","+","*","*","-","*"],["+","+","*","*","-","+"],["+","+","*","*","-","-"],["+","+","*","+","*","*"],["+","+","*","+","*","+"],["+","+","*","+","*","-"],["+","+","*","+","+","*"],["+","+","*","+","+","+"],["+","+","*","+","+","-"],["+","+","*","+","-","*"],["+","+","*","+","-","+"],["+","+","*","+","-","-"],["+","+","*","-","*","*"],["+","+","*","-","*","+"],["+","+","*","-","*","-"],["+","+","*","-","+","*"],["+","+","*","-","+","+"],["+","+","*","-","+","-"],["+","+","*","-","-","*"],["+","+","*","-","-","+"],["+","+","*","-","-","-"],["+","+","+","*","*","*"],["+","+","+","*","*","+"],["+","+","+","*","*","-"],["+","+","+","*","+","*"],["+","+","+","*","+","+"],["+","+","+","*","+","-"],["+","+","+","*","-","*"],["+","+","+","*","-","+"],["+","+","+","*","-","-"],["+","+","+","+","*","*"],["+","+","+","+","*","+"],["+","+","+","+","*","-"],["+","+","+","+","+","*"],["+","+","+","+","+","+"],["+","+","+","+","+","-"],["+","+","+","+","-","*"],["+","+","+","+","-","+"],["+","+","+","+","-","-"],["+","+","+","-","*","*"],["+","+","+","-","*","+"],["+","+","+","-","*","-"],["+","+","+","-","+","*"],["+","+","+","-","+","+"],["+","+","+","-","+","-"],["+","+","+","-","-","*"],["+","+","+","-","-","+"],["+","+","+","-","-","-"],["+","+","-","*","*","*"],["+","+","-","*","*","+"],["+","+","-","*","*","-"],["+","+","-","*","+","*"],["+","+","-","*","+","+"],["+","+","-","*","+","-"],["+","+","-","*","-","*"],["+","+","-","*","-","+"],["+","+","-","*","-","-"],["+","+","-","+","*","*"],["+","+","-","+","*","+"],["+","+","-","+","*","-"],["+","+","-","+","+","*"],["+","+","-","+","+","+"],["+","+","-","+","+","-"],["+","+","-","+","-","*"],["+","+","-","+","-","+"],["+","+","-","+","-","-"],["+","+","-","-","*","*"],["+","+","-","-","*","+"],["+","+","-","-","*","-"],["+","+","-","-","+","*"],["+","+","-","-","+","+"],["+","+","-","-","+","-"],["+","+","-","-","-","*"],["+","+","-","-","-","+"],["+","+","-","-","-","-"],["+","-","*","*","*","*"],["+","-","*","*","*","+"],["+","-","*","*","*","-"],["+","-","*","*","+","*"],["+","-","*","*","+","+"],["+","-","*","*","+","-"],["+","-","*","*","-","*"],["+","-","*","*","-","+"],["+","-","*","*","-","-"],["+","-","*","+","*","*"],["+","-","*","+","*","+"],["+","-","*","+","*","-"],["+","-","*","+","+","*"],["+","-","*","+","+","+"],["+","-","*","+","+","-"],["+","-","*","+","-","*"],["+","-","*","+","-","+"],["+","-","*","+","-","-"],["+","-","*","-","*","*"],["+","-","*","-","*","+"],["+","-","*","-","*","-"],["+","-","*","-","+","*"],["+","-","*","-","+","+"],["+","-","*","-","+","-"],["+","-","*","-","-","*"],["+","-","*","-","-","+"],["+","-","*","-","-","-"],["+","-","+","*","*","*"],["+","-","+","*","*","+"],["+","-","+","*","*","-"],["+","-","+","*","+","*"],["+","-","+","*","+","+"],["+","-","+","*","+","-"],["+","-","+","*","-","*"],["+","-","+","*","-","+"],["+","-","+","*","-","-"],["+","-","+","+","*","*"],["+","-","+","+","*","+"],["+","-","+","+","*","-"],["+","-","+","+","+","*"],["+","-","+","+","+","+"],["+","-","+","+","+","-"],["+","-","+","+","-","*"],["+","-","+","+","-","+"],["+","-","+","+","-","-"],["+","-","+","-","*","*"],["+","-","+","-","*","+"],["+","-","+","-","*","-"],["+","-","+","-","+","*"],["+","-","+","-","+","+"],["+","-","+","-","+","-"],["+","-","+","-","-","*"],["+","-","+","-","-","+"],["+","-","+","-","-","-"],["+","-","-","*","*","*"],["+","-","-","*","*","+"],["+","-","-","*","*","-"],["+","-","-","*","+","*"],["+","-","-","*","+","+"],["+","-","-","*","+","-"],["+","-","-","*","-","*"],["+","-","-","*","-","+"],["+","-","-","*","-","-"],["+","-","-","+","*","*"],["+","-","-","+","*","+"],["+","-","-","+","*","-"],["+","-","-","+","+","*"],["+","-","-","+","+","+"],["+","-","-","+","+","-"],["+","-","-","+","-","*"],["+","-","-","+","-","+"],["+","-","-","+","-","-"],["+","-","-","-","*","*"],["+","-","-","-","*","+"],["+","-","-","-","*","-"],["+","-","-","-","+","*"],["+","-","-","-","+","+"],["+","-","-","-","+","-"],["+","-","-","-","-","*"],["+","-","-","-","-","+"],["+","-","-","-","-","-"],["-","*","*","*","*","*"],["-","*","*","*","*","+"],["-","*","*","*","*","-"],["-","*","*","*","+","*"],["-","*","*","*","+","+"],["-","*","*","*","+","-"],["-","*","*","*","-","*"],["-","*","*","*","-","+"],["-","*","*","*","-","-"],["-","*","*","+","*","*"],["-","*","*","+","*","+"],["-","*","*","+","*","-"],["-","*","*","+","+","*"],["-","*","*","+","+","+"],["-","*","*","+","+","-"],["-","*","*","+","-","*"],["-","*","*","+","-","+"],["-","*","*","+","-","-"],["-","*","*","-","*","*"],["-","*","*","-","*","+"],["-","*","*","-","*","-"],["-","*","*","-","+","*"],["-","*","*","-","+","+"],["-","*","*","-","+","-"],["-","*","*","-","-","*"],["-","*","*","-","-","+"],["-","*","*","-","-","-"],["-","*","+","*","*","*"],["-","*","+","*","*","+"],["-","*","+","*","*","-"],["-","*","+","*","+","*"],["-","*","+","*","+","+"],["-","*","+","*","+","-"],["-","*","+","*","-","*"],["-","*","+","*","-","+"],["-","*","+","*","-","-"],["-","*","+","+","*","*"],["-","*","+","+","*","+"],["-","*","+","+","*","-"],["-","*","+","+","+","*"],["-","*","+","+","+","+"],["-","*","+","+","+","-"],["-","*","+","+","-","*"],["-","*","+","+","-","+"],["-","*","+","+","-","-"],["-","*","+","-","*","*"],["-","*","+","-","*","+"],["-","*","+","-","*","-"],["-","*","+","-","+","*"],["-","*","+","-","+","+"],["-","*","+","-","+","-"],["-","*","+","-","-","*"],["-","*","+","-","-","+"],["-","*","+","-","-","-"],["-","*","-","*","*","*"],["-","*","-","*","*","+"],["-","*","-","*","*","-"],["-","*","-","*","+","*"],["-","*","-","*","+","+"],["-","*","-","*","+","-"],["-","*","-","*","-","*"],["-","*","-","*","-","+"],["-","*","-","*","-","-"],["-","*","-","+","*","*"],["-","*","-","+","*","+"],["-","*","-","+","*","-"],["-","*","-","+","+","*"],["-","*","-","+","+","+"],["-","*","-","+","+","-"],["-","*","-","+","-","*"],["-","*","-","+","-","+"],["-","*","-","+","-","-"],["-","*","-","-","*","*"],["-","*","-","-","*","+"],["-","*","-","-","*","-"],["-","*","-","-","+","*"],["-","*","-","-","+","+"],["-","*","-","-","+","-"],["-","*","-","-","-","*"],["-","*","-","-","-","+"],["-","*","-","-","-","-"],["-","+","*","*","*","*"],["-","+","*","*","*","+"],["-","+","*","*","*","-"],["-","+","*","*","+","*"],["-","+","*","*","+","+"],["-","+","*","*","+","-"],["-","+","*","*","-","*"],["-","+","*","*","-","+"],["-","+","*","*","-","-"],["-","+","*","+","*","*"],["-","+","*","+","*","+"],["-","+","*","+","*","-"],["-","+","*","+","+","*"],["-","+","*","+","+","+"],["-","+","*","+","+","-"],["-","+","*","+","-","*"],["-","+","*","+","-","+"],["-","+","*","+","-","-"],["-","+","*","-","*","*"],["-","+","*","-","*","+"],["-","+","*","-","*","-"],["-","+","*","-","+","*"],["-","+","*","-","+","+"],["-","+","*","-","+","-"],["-","+","*","-","-","*"],["-","+","*","-","-","+"],["-","+","*","-","-","-"],["-","+","+","*","*","*"],["-","+","+","*","*","+"],["-","+","+","*","*","-"],["-","+","+","*","+","*"],["-","+","+","*","+","+"],["-","+","+","*","+","-"],["-","+","+","*","-","*"],["-","+","+","*","-","+"],["-","+","+","*","-","-"],["-","+","+","+","*","*"],["-","+","+","+","*","+"],["-","+","+","+","*","-"],["-","+","+","+","+","*"],["-","+","+","+","+","+"],["-","+","+","+","+","-"],["-","+","+","+","-","*"],["-","+","+","+","-","+"],["-","+","+","+","-","-"],["-","+","+","-","*","*"],["-","+","+","-","*","+"],["-","+","+","-","*","-"],["-","+","+","-","+","*"],["-","+","+","-","+","+"],["-","+","+","-","+","-"],["-","+","+","-","-","*"],["-","+","+","-","-","+"],["-","+","+","-","-","-"],["-","+","-","*","*","*"],["-","+","-","*","*","+"],["-","+","-","*","*","-"],["-","+","-","*","+","*"],["-","+","-","*","+","+"],["-","+","-","*","+","-"],["-","+","-","*","-","*"],["-","+","-","*","-","+"],["-","+","-","*","-","-"],["-","+","-","+","*","*"],["-","+","-","+","*","+"],["-","+","-","+","*","-"],["-","+","-","+","+","*"],["-","+","-","+","+","+"],["-","+","-","+","+","-"],["-","+","-","+","-","*"],["-","+","-","+","-","+"],["-","+","-","+","-","-"],["-","+","-","-","*","*"],["-","+","-","-","*","+"],["-","+","-","-","*","-"],["-","+","-","-","+","*"],["-","+","-","-","+","+"],["-","+","-","-","+","-"],["-","+","-","-","-","*"],["-","+","-","-","-","+"],["-","+","-","-","-","-"],["-","-","*","*","*","*"],["-","-","*","*","*","+"],["-","-","*","*","*","-"],["-","-","*","*","+","*"],["-","-","*","*","+","+"],["-","-","*","*","+","-"],["-","-","*","*","-","*"],["-","-","*","*","-","+"],["-","-","*","*","-","-"],["-","-","*","+","*","*"],["-","-","*","+","*","+"],["-","-","*","+","*","-"],["-","-","*","+","+","*"],["-","-","*","+","+","+"],["-","-","*","+","+","-"],["-","-","*","+","-","*"],["-","-","*","+","-","+"],["-","-","*","+","-","-"],["-","-","*","-","*","*"],["-","-","*","-","*","+"],["-","-","*","-","*","-"],["-","-","*","-","+","*"],["-","-","*","-","+","+"],["-","-","*","-","+","-"],["-","-","*","-","-","*"],["-","-","*","-","-","+"],["-","-","*","-","-","-"],["-","-","+","*","*","*"],["-","-","+","*","*","+"],["-","-","+","*","*","-"],["-","-","+","*","+","*"],["-","-","+","*","+","+"],["-","-","+","*","+","-"],["-","-","+","*","-","*"],["-","-","+","*","-","+"],["-","-","+","*","-","-"],["-","-","+","+","*","*"],["-","-","+","+","*","+"],["-","-","+","+","*","-"],["-","-","+","+","+","*"],["-","-","+","+","+","+"],["-","-","+","+","+","-"],["-","-","+","+","-","*"],["-","-","+","+","-","+"],["-","-","+","+","-","-"],["-","-","+","-","*","*"],["-","-","+","-","*","+"],["-","-","+","-","*","-"],["-","-","+","-","+","*"],["-","-","+","-","+","+"],["-","-","+","-","+","-"],["-","-","+","-","-","*"],["-","-","+","-","-","+"],["-","-","+","-","-","-"],["-","-","-","*","*","*"],["-","-","-","*","*","+"],["-","-","-","*","*","-"],["-","-","-","*","+","*"],["-","-","-","*","+","+"],["-","-","-","*","+","-"],["-","-","-","*","-","*"],["-","-","-","*","-","+"],["-","-","-","*","-","-"],["-","-","-","+","*","*"],["-","-","-","+","*","+"],["-","-","-","+","*","-"],["-","-","-","+","+","*"],["-","-","-","+","+","+"],["-","-","-","+","+","-"],["-","-","-","+","-","*"],["-","-","-","+","-","+"],["-","-","-","+","-","-"],["-","-","-","-","*","*"],["-","-","-","-","*","+"],["-","-","-","-","*","-"],["-","-","-","-","+","*"],["-","-","-","-","+","+"],["-","-","-","-","+","-"],["-","-","-","-","-","*"],["-","-","-","-","-","+"],["-","-","-","-","-","-"]]]] + [ + [ + [1,1] + ], + + [ + [1,1,1], + [1,2], + [2,1] + ], + + [ + [1,1,1,1], + [1,1,2], + [1,2,1], + [2,1,1], + [1,3], + [3,1], + [2,2] + ], + + [ + [1,1,1,1,1], + [1,1,1,2], + [1,1,2,1], + [1,2,1,1], + [2,1,1,1], + [1,1,3], + [1,3,1], + [3,1,1], + [1,2,2], + [2,1,2], + [2,2,1], + [1,4], + [4,1], + [2,3], + [3,2] + ], + + [ + [1,1,1,1,1,1], + [1,1,1,1,2], + [1,1,1,2,1], + [1,1,2,1,1], + [1,2,1,1,1], + [2,1,1,1,1], + [1,1,1,3], + [1,1,3,1], + [1,3,1,1], + [3,1,1,1], + [1,1,2,2], + [1,2,1,2], + [1,2,2,1], + [2,1,1,2], + [2,1,2,1], + [2,2,1,1], + [1,1,4], + [1,4,1], + [4,1,1], + [1,2,3], + [1,3,2], + [2,1,3], + [2,3,1], + [3,1,2], + [3,2,1], + [1,5], + [5,1], + [2,2,2], + [2,4], + [4,2], + [3,3] + ], + + [ + [1,1,1,1,1,1,1], + [1,1,1,1,1,2], + [1,1,1,1,2,1], + [1,1,1,2,1,1], + [1,1,2,1,1,1], + [1,2,1,1,1,1], + [2,1,1,1,1,1], + [1,1,1,1,3], + [1,1,1,3,1], + [1,1,3,1,1], + [1,3,1,1,1], + [3,1,1,1,1], + [1,1,1,2,2], + [1,1,2,1,2], + [1,1,2,2,1], + [1,2,1,1,2], + [1,2,1,2,1], + [1,2,2,1,1], + [2,1,1,1,2], + [2,1,1,2,1], + [2,1,2,1,1], + [2,2,1,1,1], + [1,1,1,4], + [1,1,4,1], + [1,4,1,1], + [4,1,1,1], + [1,1,2,3], + [1,1,3,2], + [1,2,1,3], + [1,2,3,1], + [1,3,1,2], + [1,3,2,1], + [2,1,1,3], + [2,1,3,1], + [2,3,1,1], + [3,1,1,2], + [3,1,2,1], + [3,2,1,1], + [1,1,5], + [1,5,1], + [5,1,1], + [1,2,2,2], + [2,1,2,2], + [2,2,1,2], + [2,2,2,1], + [1,2,4], + [1,4,2], + [2,1,4], + [2,4,1], + [4,1,2], + [4,2,1], + [1,3,3], + [3,1,3], + [3,3,1], + [1,6], + [6,1], + [2,2,3], + [2,3,2], + [3,2,2], + [2,5], + [5,2], + [3,4], + [4,3] + ] + ], + + [ + [ + ["*"],["+"],["-"] + ], + + [ + ["*","*"], + ["*","+"], + ["*","-"], + ["+","*"], + ["+","+"], + ["+","-"], + ["-","*"], + ["-","+"], + ["-","-"] + ], + + [ + ["*","*","*"], + ["*","*","+"], + ["*","*","-"], + ["*","+","*"], + ["*","+","+"], + ["*","+","-"], + ["*","-","*"], + ["*","-","+"], + ["*","-","-"], + ["+","*","*"], + ["+","*","+"], + ["+","*","-"], + ["+","+","*"], + ["+","+","+"], + ["+","+","-"], + ["+","-","*"], + ["+","-","+"], + ["+","-","-"], + ["-","*","*"], + ["-","*","+"], + ["-","*","-"], + ["-","+","*"], + ["-","+","+"], + ["-","+","-"], + ["-","-","*"], + ["-","-","+"], + ["-","-","-"] + ], + + [ + ["*","*","*","*"], + ["*","*","*","+"], + ["*","*","*","-"], + ["*","*","+","*"], + ["*","*","+","+"], + ["*","*","+","-"], + ["*","*","-","*"], + ["*","*","-","+"], + ["*","*","-","-"], + ["*","+","*","*"], + ["*","+","*","+"], + ["*","+","*","-"], + ["*","+","+","*"], + ["*","+","+","+"], + ["*","+","+","-"], + ["*","+","-","*"], + ["*","+","-","+"], + ["*","+","-","-"], + ["*","-","*","*"], + ["*","-","*","+"], + ["*","-","*","-"], + ["*","-","+","*"], + ["*","-","+","+"], + ["*","-","+","-"], + ["*","-","-","*"], + ["*","-","-","+"], + ["*","-","-","-"], + ["+","*","*","*"], + ["+","*","*","+"], + ["+","*","*","-"], + ["+","*","+","*"], + ["+","*","+","+"], + ["+","*","+","-"], + ["+","*","-","*"], + ["+","*","-","+"], + ["+","*","-","-"], + ["+","+","*","*"], + ["+","+","*","+"], + ["+","+","*","-"], + ["+","+","+","*"], + ["+","+","+","+"], + ["+","+","+","-"], + ["+","+","-","*"], + ["+","+","-","+"], + ["+","+","-","-"], + ["+","-","*","*"], + ["+","-","*","+"], + ["+","-","*","-"], + ["+","-","+","*"], + ["+","-","+","+"], + ["+","-","+","-"], + ["+","-","-","*"], + ["+","-","-","+"], + ["+","-","-","-"], + ["-","*","*","*"], + ["-","*","*","+"], + ["-","*","*","-"], + ["-","*","+","*"], + ["-","*","+","+"], + ["-","*","+","-"], + ["-","*","-","*"], + ["-","*","-","+"], + ["-","*","-","-"], + ["-","+","*","*"], + ["-","+","*","+"], + ["-","+","*","-"], + ["-","+","+","*"], + ["-","+","+","+"], + ["-","+","+","-"], + ["-","+","-","*"], + ["-","+","-","+"], + ["-","+","-","-"], + ["-","-","*","*"], + ["-","-","*","+"], + ["-","-","*","-"], + ["-","-","+","*"], + ["-","-","+","+"], + ["-","-","+","-"], + ["-","-","-","*"], + ["-","-","-","+"], + ["-","-","-","-"] + ], + + [ + ["*","*","*","*","*"], + ["*","*","*","*","+"], + ["*","*","*","*","-"], + ["*","*","*","+","*"], + ["*","*","*","+","+"], + ["*","*","*","+","-"], + ["*","*","*","-","*"], + ["*","*","*","-","+"], + ["*","*","*","-","-"], + ["*","*","+","*","*"], + ["*","*","+","*","+"], + ["*","*","+","*","-"], + ["*","*","+","+","*"], + ["*","*","+","+","+"], + ["*","*","+","+","-"], + ["*","*","+","-","*"], + ["*","*","+","-","+"], + ["*","*","+","-","-"], + ["*","*","-","*","*"], + ["*","*","-","*","+"], + ["*","*","-","*","-"], + ["*","*","-","+","*"], + ["*","*","-","+","+"], + ["*","*","-","+","-"], + ["*","*","-","-","*"], + ["*","*","-","-","+"], + ["*","*","-","-","-"], + ["*","+","*","*","*"], + ["*","+","*","*","+"], + ["*","+","*","*","-"], + ["*","+","*","+","*"], + ["*","+","*","+","+"], + ["*","+","*","+","-"], + ["*","+","*","-","*"], + ["*","+","*","-","+"], + ["*","+","*","-","-"], + ["*","+","+","*","*"], + ["*","+","+","*","+"], + ["*","+","+","*","-"], + ["*","+","+","+","*"], + ["*","+","+","+","+"], + ["*","+","+","+","-"], + ["*","+","+","-","*"], + ["*","+","+","-","+"], + ["*","+","+","-","-"], + ["*","+","-","*","*"], + ["*","+","-","*","+"], + ["*","+","-","*","-"], + ["*","+","-","+","*"], + ["*","+","-","+","+"], + ["*","+","-","+","-"], + ["*","+","-","-","*"], + ["*","+","-","-","+"], + ["*","+","-","-","-"], + ["*","-","*","*","*"], + ["*","-","*","*","+"], + ["*","-","*","*","-"], + ["*","-","*","+","*"], + ["*","-","*","+","+"], + ["*","-","*","+","-"], + ["*","-","*","-","*"], + ["*","-","*","-","+"], + ["*","-","*","-","-"], + ["*","-","+","*","*"], + ["*","-","+","*","+"], + ["*","-","+","*","-"], + ["*","-","+","+","*"], + ["*","-","+","+","+"], + ["*","-","+","+","-"], + ["*","-","+","-","*"], + ["*","-","+","-","+"], + ["*","-","+","-","-"], + ["*","-","-","*","*"], + ["*","-","-","*","+"], + ["*","-","-","*","-"], + ["*","-","-","+","*"], + ["*","-","-","+","+"], + ["*","-","-","+","-"], + ["*","-","-","-","*"], + ["*","-","-","-","+"], + ["*","-","-","-","-"], + ["+","*","*","*","*"], + ["+","*","*","*","+"], + ["+","*","*","*","-"], + ["+","*","*","+","*"], + ["+","*","*","+","+"], + ["+","*","*","+","-"], + ["+","*","*","-","*"], + ["+","*","*","-","+"], + ["+","*","*","-","-"], + ["+","*","+","*","*"], + ["+","*","+","*","+"], + ["+","*","+","*","-"], + ["+","*","+","+","*"], + ["+","*","+","+","+"], + ["+","*","+","+","-"], + ["+","*","+","-","*"], + ["+","*","+","-","+"], + ["+","*","+","-","-"], + ["+","*","-","*","*"], + ["+","*","-","*","+"], + ["+","*","-","*","-"], + ["+","*","-","+","*"], + ["+","*","-","+","+"], + ["+","*","-","+","-"], + ["+","*","-","-","*"], + ["+","*","-","-","+"], + ["+","*","-","-","-"], + ["+","+","*","*","*"], + ["+","+","*","*","+"], + ["+","+","*","*","-"], + ["+","+","*","+","*"], + ["+","+","*","+","+"], +