aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad Sajid Anwar <Mohammad.Anwar@yahoo.com>2025-11-03 16:09:36 +0000
committerGitHub <noreply@github.com>2025-11-03 16:09:36 +0000
commitf230b25bb434c1b10aa4624121389462976c7d1f (patch)
treef6d152754448b70f52f3dd54614afa7dfb768e58
parentf4f27bf66e78dacae8759f64053b36bd1995b34f (diff)
parentde10e43cde2640b2d0885697fea1b94b6ee43427 (diff)
downloadperlweeklychallenge-club-f230b25bb434c1b10aa4624121389462976c7d1f.tar.gz
perlweeklychallenge-club-f230b25bb434c1b10aa4624121389462976c7d1f.tar.bz2
perlweeklychallenge-club-f230b25bb434c1b10aa4624121389462976c7d1f.zip
Merge pull request #12963 from andemark/challenge-346
Challenge 346 Solutions (Raku)
-rw-r--r--challenge-346/mark-anderson/raku/ch-1.raku20
-rw-r--r--challenge-346/mark-anderson/raku/ch-2.raku81
2 files changed, 101 insertions, 0 deletions
diff --git a/challenge-346/mark-anderson/raku/ch-1.raku b/challenge-346/mark-anderson/raku/ch-1.raku
new file mode 100644
index 0000000000..3bb622d2ee
--- /dev/null
+++ b/challenge-346/mark-anderson/raku/ch-1.raku
@@ -0,0 +1,20 @@
+#!/usr/bin/env raku
+use Test;
+
+is longest-parenthesis('(()())'), 6;
+is longest-parenthesis(')()())'), 4;
+is longest-parenthesis('(((()))()(((()'), 8;
+is longest-parenthesis('))))((()('), 2;
+is longest-parenthesis('()(()'), 2;
+
+# I think I want to use the <~~> recursive feature here but I
+# don't really understand it. The following comes close but it
+# doesn't quite give the output I want.
+
+# $str ~~ m:g/ '(' [ <-[()]>* <~~> <-[()]>* ]* ')' /;
+
+sub longest-parenthesis($str)
+{
+ my @m = $str ~~ m:g/ [ ('('+) (')'+) ]+ <?{ ~$0.chars == ~$1.chars }> /;
+ max @m>>.chars
+}
diff --git a/challenge-346/mark-anderson/raku/ch-2.raku b/challenge-346/mark-anderson/raku/ch-2.raku
new file mode 100644
index 0000000000..60238a8f9d
--- /dev/null
+++ b/challenge-346/mark-anderson/raku/ch-2.raku
@@ -0,0 +1,81 @@
+#!/usr/bin/env raku
+use JSON::Fast;
+use Test;
+
+is-deeply magic-expression("123", 6), ("1*2*3", "1+2+3");
+is-deeply magic-expression("105", 5), ("1*0+5", "10-5");
+is-deeply magic-expression("232", 8), ("2*3+2", "2+3*2");
+is-deeply magic-expression("1234", 10), ("1*2*3+4", "1+2+3+4");
+is-deeply magic-expression("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");
+
+#
+# With help from https://andrewshitov.com/2018/10/31/creating-a-calculator-with-perl-6-grammars/
+#
+
+grammar Calculate
+{
+ rule TOP { <add-sub> }
+ rule add-sub { <mult>+ % $<op>=<[+-]> }
+ rule mult { <digits>+ % '*' }
+ rule digits { <digit>+ }
+}
+
+class Actions
+{
+ method TOP($/) { make $<add-sub>.made }
+ method digits($/) { make $/ }
+ method mult($/) { make [*] $<digits>>>.made }
+ method add-sub($/)
+ {
+ my @ops = $<op>>>.Str;
+ my @vals = $<mult>>>.made;
+ my $result;
+
+ for @vals Z @ops.unshift('+')
+ {
+ if .tail eq '+' { $result += .head }
+ else { $result -= .head }
+ }
+
+ make $result
+ }
+}
+
+multi magic-expression($str where *.chars > 7, $target)
+{
+ note "This is a brute force solution: \$str must be 7 characters or less"
+}
+
+multi magic-expression($str, $target)
+{
+ my @nums = $str.comb;
+ my (@partitions, @operators) := from-json $=finish;
+
+ gather for @partitions[@nums-2]<> -> @p
+ {
+ my @r = @nums.rotor(@p)>>.join;
+ next if any @r ~~ /^0\d/;
+
+ for @operators[@p-2]<> -> @o
+ {
+ my $exp = flat roundrobin @r, @o;
+ 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]]],
+
+[[["*"],["+"],["-"]],
+[["*","*"],["*","+"],["*","-"],["+","*"],["+","+"],["+","-"],["-","*"],["-","+"],["-","-"]],
+[["*","*","*"],["*","*","+"],["*","*","-"],["*","+","*"],["*","+","+"],["*","+","-"],["*","-","*"],["*","-","+"],["*","-","-"],["+","*","*"],["+","*","+"],["+","*","-"],["+","+","*"],["+","+","+"],["+","+","-"],["+","-","*"],["+","-","+"],["+","-","-"],["-","*","*"],["-","*","+"],["-","*","-"],["-","+","*"],["-","+","+"],["-","+","-"],["-","-","*"],["-","-","+"],["-","-","-"]],
+[["*","*","*","*"],["*","*","*","+"],["*","*","*","-"],["*","*","+","*"],["*","*","+","+"],["*","*","+","-"],["*","*","-","*"],["*","*","-","+"],["*","*","-","-"],["*","+","*","*"],["*","+","*","+"],["*","+","*","-"],["*","+","+","*"],["*","+","+","+"],["*","+","+","-"],["*","+","-","*"],["*","+","-","+"],["*","+","-","-"],["*","-","*","*"],["*","-","*","+"],["*","-","*","-"],["*","-","+","*"],["*","-","+","+"],["*","-","+","-"],["*","-","-","*"],["*","-","-","+"],["*","-","-","-"],["+","*","*","*"],["+","*","*","+"],["+","*","*","-"],["+","*","+","*"],["+","*","+","+"],["+","*","+","-"],["+","*","-","*"],["+","*","-","+"],["+","*","-","-"],["+","+","*","*"],["+","+","*","+"],["+","+","*","-"],["+","+","+","*"],["+","+","+","+"],["+","+","+","-"],["+","+","-","*"],["+","+","-","+"],["+","+","-","-"],["+","-","*","*"],["+","-","*","+"],["+","-","*","-"],["+","-","+","*"],["+","-","+","+"],["+","-","+","-"],["+","-","-","*"],["+","-","-","+"],["+","-","-","-"],["-","*","*","*"],["-","*","*","+"],["-","*","*","-"],["-","*","+","*"],["-","*","+","+"],["-","*","+","-"],["-","*","-","*"],["-","*","-","+"],["-","*","-","-"],["-","+","*","*"],["-","+","*","+"],["-","+","*","-"],["-","+","+","*"],["-","+","+","+"],["-","+","+","-"],["-","+","-","*"],["-","+","-","+"],["-","+","-","-"],["-","-","*","*"],["-","-","*","+"],["-","-","*","-"],["-","-","+","*"],["-","-","+","+"],["-","-","+","-"],["-","-","-","*"],["-","-","-","+"],["-","-","-","-"]],
+[["*","*","*","*","*"],["*","*","*","*","+"],["*","*","*","*","-"],["*","*","*","+","*"],["*","*","*","+","+"],["*","*","*","+","-"],["*","*","*","-","*"],["*","*","*","-","+"],["*","*","*","-","-"],["*","*","+","*","*"],["*","*","+","*","+"],["*","*","+","*","-"],["*","*","+","+","*"],["*","*","+","+","+"],["*","*","+","+","-"],["*","*","+","-","*"],["*","*","+","-","+"],["*","*","+","-","-"],["*","*","-","*","*"],["*","*","-","*","+"],["*","*","-","*","-"],["*","*","-","+","*"],["*","*","-","+","+"],["*","*","-","+","-"],["*","*","-","-","*"],["*","*","-","-","+"],["*","*","-","-","-"],["*","+","*","*","*"],["*","+","*","*","+"],["*","+","*","*","-"],["*","+","*","+","*"],["*","+","*","+","+"],["*","+","*","+","-"],["*","+","*","-","*"],["*","+","*","-","+"],["*","+","*","-","-"],["*","+","+","*","*"],["*","+","+","*","+"],["*","+","+","*","-"],["*","+","+","+","*"],["*","+","+","+","+"],["*","+","+","+","-"],["*","+","+","-","*"],["*","+","+","-","+"],["*","+","+","-","-"],["*","+","-","*","*"],["*","+","-","*","+"],["*","+","-","*","-"],["*","+","-","+","*"],["*","+","-","+","+"],["*","+","-","+","-"],["*","+","-","-","*"],["*","+","-","-","+"],["*","+","-","-","-"],["*","-","*","*","*"],["*","-","*","*","+"],["*","-","*","*","-"],["*","-","*","+","*"],["*","-","*","+","+"],["*","-","*","+","-"],["*","-","*","-","*"],["*","-","*","-","+"],["*","-","*","-","-"],["*","-","+","*","*"],["*","-","+","*","+"],["*","-","+","*","-"],["*","-","+","+","*"],["*","-","+","+","+"],["*","-","+","+","-"],["*","-","+","-","*"],["*","-","+","-","+"],["*","-","+","-","-"],["*","-","-","*","*"],["*","-","-","*","+"],["*","-","-","*","-"],["*","-","-","+","*"],["*","-","-","+","+"],["*","-","-","+","-"],["*","-","-","-","*"],["*","-","-","-","+"],["*","-","-","-","-"],["+","*","*","*","*"],["+","*","*","*","+"],["+","*","*","*","-"],["+","*","*","+","*"],["+","*","*","+","+"],["+","*","*","+","-"],["+","*","*","-","*"],["+","*","*","-","+"],["+","*","*","-","-"],["+","*","+","*","*"],["+","*","+","*","+"],["+","*","+","*","-"],["+","*","+","+","*"],["+","*","+","+","+"],["+","*","+","+","-"],["+","*","+","-","*"],["+","*","+","-","+"],["+","*","+","-","-"],["+","*","-","*","*"],["+","*","-","*","+"],["+","*","-","*","-"],["+","*","-","+","*"],["+","*","-","+","+"],["+","*","-","+","-"],["+","*","-","-","*"],["+","*","-","-","+"],["+","*","-","-","-"],["+","+","*","*","*"],["+","+","*","*","+"],["+","+","*","*","-"],["+","+","*","+","*"],["+","+","*","+","+"],["+","+","*","+","-"],["+","+","*","-","*"],["+","+","*","-","+"],["+","+","*","-","-"],["+","+","+","*","*"],["+","+","+","*","+"],["+","+","+","*","-"],["+","+","+","+","*"],["+","+","+","+","+"],["+","+","+","+","-"],["+","+","+","-","*"],["+","+","+","-","+"],["+","+","+","-","-"],["+","+","-","*","*"],["+","+","-","*","+"],["+","+","-","*","-"],["+","+","-","+","*"],["+","+","-","+","+"],["+","+","-","+","-"],["+","+","-","-","*"],["+","+","-","-","+"],["+","+","-","-","-"],["+","-","*","*","*"],["+","-","*","*","+"],["+","-","*","*","-"],["+","-","*","+","*"],["+","-","*","+","+"],["+","-","*","+","-"],["+","-","*","-","*"],["+","-","*","-","+"],["+","-","*","-","-"],["+","-","+","*","*"],["+","-","+","*","+"],["+","-","+","*","-"],["+","-","+","+","*"],["+","-","+","+","+"],["+","-","+","+","-"],["+","-","+","-","*"],["+","-","+","-","+"],["+","-","+","-","-"],["+","-","-","*","*"],["+","-","-","*","+"],["+","-","-","*","-"],["+","-","-","+","*"],["+","-","-","+","+"],["+","-","-","+","-"],["+","-","-","-","*"],["+","-","-","-","+"],["+","-","-","-","-"],["-","*","*","*","*"],["-","*","*","*","+"],["-","*","*","*","-"],["-","*","*","+","*"],["-","*","*","+","+"],["-","*","*","+","-"],["-","*","*","-","*"],["-","*","*","-","+"],["-","*","*","-","-"],["-","*","+","*","*"],["-","*","+","*","+"],["-","*","+","*","-"],["-","*","+","+","*"],["-","*","+","+","+"],["-","*","+","+","-"],["-","*","+","-","*"],["-","*","+","-","+"],["-","*","+","-","-"],["-","*","-","*","*"],["-","*","-","*","+"],["-","*","-","*","-"],["-","*","-","+","*"],["-","*","-","+","+"],["-","*","-","+","-"],["-","*","-","-","*"],["-","*","-","-","+"],["-","*","-","-","-"],["-","+","*","*","*"],["-","+","*","*","+"],["-","+","*","*","-"],["-","+","*","+","*"],["-","+","*","+","+"],["-","+","*","+","-"],["-","+","*","-","*"],["-","+","*","-","+"],["-","+","*","-","-"],["-","+","+","*","*"],["-","+","+","*","+"],["-","+","+","*","-"],["-","+","+","+","*"],["-","+","+","+","+"],["-","+","+","+","-"],["-","+","+","-","*"],["-","+","+","-","+"],["-","+","+","-","-"],["-","+","-","*","*"],["-","+","-","*","+"],["-","+","-","*","-"],["-","+","-","+","*"],["-","+","-","+","+"],["-","+","-","+","-"],["-","+","-","-","*"],["-","+","-","-","+"],["-","+","-","-","-"],["-","-","*","*","*"],["-","-","*","*","+"],["-","-","*","*","-"],["-","-","*","+","*"],["-","-","*","+","+"],["-","-","*","+","-"],["-","-","*","-","*"],["-","-","*","-","+"],["-","-","*","-","-"],["-","-","+","*","*"],["-","-","+","*","+"],["-","-","+","*","-"],["-","-","+","+","*"],["-","-","+","+","+"],["-","-","+","+","-"],["-","-","+","-","*"],["-","-","+","-","+"],["-","-","+","-","-"],["-","-","-","*","*"],["-","-","-","*","+"],["-","-","-","*","-"],["-","-","-","+","*"],["-","-","-","+","+"],["-","-","-","+","-"],["-","-","-","-","*"],["-","-","-","-","+"],["-","-","-","-","-"]],
+[["*","*","*","*","*","*"],["*","*","*","*","*","+"],["*","*","*","*","*","-"],["*","*","*","*","+","*"],["*","*","*","*","+","+"],["*","*","*","*","+","-"],["*","*","*","*","-","*"],["*","*","*","*","-","+"],["*","*","*","*","-","-"],["*","*","*","+","*","*"],["*","*","*","+","*","+"],["*","*","*","+","*","-"],["*","*","*","+","+","*"],["*","*","*","+","+","+"],["*","*","*","+","+","-"],["*","*","*","+","-","*"],["*","*","*","+","-","+"],["*","*","*","+","-","-"],["*","*","*","-","*","*"],["*","*","*","-","*","+"],["*","*","*","-","*","-"],["*","*","*","-","+","*"],["*","*","*","-","+","+"],["*","*","*","-","+","-"],["*","*","*","-","-","*"],["*","*","*","-","-","+"],["*","*","*","-","-","-"],["*","*","+","*","*","*"],["*","*","+","*","*","+"],["*","*","+","*","*","-"],["*","*","+","*","+","*"],["*","*","+","*","+","+"],["*","*","+","*","+","-"],["*","*","+","*","-","*"],["*","*","+","*","-","+"],["*","*","+","*","-","-"],["*","*","+","+","*","*"],["*","*","+","+","*","+"],["*","*","+","+","*","-"],["*","*","+","+","+","*"],["*","*","+","+","+","+"],["*","*","+","+","+","-"],["*","*","+","+","-","*"],["*","*","+","+","-","+"],["*","*","+","+","-","-"],["*","*","+","-","*","*"],["*","*","+","-","*","+"],["*","*","+","-","*","-"],["*","*","+","-","+","*"],["*","*","+","-","+","+"],["*","*","+","-","+","-"],["*","*","+","-","-","*"],["*","*","+","-","-","+"],["*","*","+","-","-","-"],["*","*","-","*","*","*"],["*","*","-","*","*","+"],["*","*","-","*","*","-"],["*","*","-","*","+","*"],["*","*","-","*","+","+"],["*","*","-","*","+","-"],["*","*","-","*","-","*"],["*","*","-","*","-","+"],["*","*","-","*","-","-"],["*","*","-","+","*","*"],["*","*","-","+","*","+"],["*","*","-","+","*","-"],["*","*","-","+","+","*"],["*","*","-","+","+","+"],["*","*","-","+","+","-"],["*","*","-","+","-","*"],["*","*","-","+","-","+"],["*","*","-","+","-","-"],["*","*","-","-","*","*"],["*","*","-","-","*","+"],["*","*","-","-","*","-"],["*","*","-","-","+","*"],["*","*","-","-","+","+"],["*","*","-","-","+","-"],["*","*","-","-","-","*"],["*","*","-","-","-","+"],["*","*","-","-","-","-"],["*","+","*","*","*","*"],["*","+","*","*","*","+"],["*","+","*","*","*","-"],["*","+","*","*","+","*"],["*","+","*","*","+","+"],["*","+","*","*","+","-"],["*","+","*","*","-","*"],["*","+","*","*","-","+"],["*","+","*","*","-","-"],["*","+","*","+","*","*"],["*","+","*","+","*","+"],["*","+","*","+","*","-"],["*","+","*","+","+","*"],["*","+","*","+","+","+"],["*","+","*","+","+","-"],["*","+","*","+","-","*"],["*","+","*","+","-","+"],["*","+","*","+","-","-"],["*","+","*","-","*","*"],["*","+","*","-","*","+"],["*","+","*","-","*","-"],["*","+","*","-","+","*"],["*","+","*","-","+","+"],["*","+","*","-","+","-"],["*","+","*","-","-","*"],["*","+","*","-","-","+"],["*","+","*","-","-","-"],["*","+","+","*","*","*"],["*","+","+","*","*","+"],["*","+","+","*","*","-"],["*","+","+","*","+","*"],["*","+","+","*","+","+"],["*","+","+","*","+","-"],["*","+","+","*","-","*"],["*","+","+","*","-","+"],["*","+","+","*","-","-"],["*","+","+","+","*","*"],["*","+","+","+","*","+"],["*","+","+","+","*","-"],["*","+","+","+","+","*"],["*","+","+","+","+","+"],["*","+","+","+","+","-"],["*","+","+","+","-","*"],["*","+","+","+","-","+"],["*","+","+","+","-","-"],["*","+","+","-","*","*"],["*","+","+","-","*","+"],["*","+","+","-","*","-"],["*","+","+","-","+","*"],["*","+","+","-","+","+"],["*","+","+","-","+","-"],["*","+","+","-","-","*"],["*","+","+","-","-","+"],["*","+","+","-","-","-"],["*","+","-","*","*","*"],["*","+","-","*","*","+"],["*","+","-","*","*","-"],["*","+","-","*","+","*"],["*","+","-","*","+","+"],["*","+","-","*","+","-"],["*","+","-","*","-","*"],["*","+","-","*","-","+"],["*","+","-","*","-","-"],["*","+","-","+","*","*"],["*","+","-","+","*","+"],["*","+","-","+","*","-"],["*","+","-","+","+","*"],["*","+","-","+","+","+"],["*","+","-","+","+","-"],["*","+","-","+","-","*"],["*","+","-","+","-","+"],["*","+","-","+","-","-"],["*","+","-","-","*","*"],["*","+","-","-","*","+"],["*","+","-","-","*","-"],["*","+","-","-","+","*"],["*","+","-","-","+","+"],["*","+","-","-","+","-"],["*","+","-","-","-","*"],["*","+","-","-","-","+"],["*","+","-","-","-","-"],["*","-","*","*","*","*"],["*","-","*","*","*","+"],["*","-","*","*","*","-"],["*","-","*","*","+","*"],["*","-","*","*","+","+"],["*","-","*","*","+","-"],["*","-","*","*","-","*"],["*","-","*","*","-","+"],["*","-","*","*","-","-"],["*","-","*","+","*","*"],["*","-","*","+","*","+"],["*","-","*","+","*","-"],["*","-","*","+","+","*"],["*","-","*","+","+","+"],["*","-","*","+","+","-"],["*","-","*","+","-","*"],["*","-","*","+","-","+"],["*","-","*","+","-","-"],["*","-","*","-","*","*"],["*","-","*","-","*","+"],["*","-","*","-","*","-"],["*","-","*","-","+","*"],["*","-","*","-","+","+"],["*","-","*","-","+","-"],["*","-","*","-","-","*"],["*","-","*","-","-","+"],["*","-","*","-","-","-"],["*","-","+","*","*","*"],["*","-","+","*","*","+"],["*","-","+","*","*","-"],["*","-","+","*","+","*"],["*","-","+","*","+","+"],["*","-","+","*","+","-"],["*","-","+","*","-","*"],["*","-","+","*","-","+"],["*","-","+","*","-","-"],["*","-","+","+","*","*"],["*","-","+","+","*","+"],["*","-","+","+","*","-"],["*","-","+","+","+","*"],["*","-","+","+","+","+"],["*","-","+","+","+","-"],["*","-","+","+","-","*"],["*","-","+","+","-","+"],["*","-","+","+","-","-"],["*","-","+","-","*","*"],["*","-","+","-","*","+"],["*","-","+","-","*","-"],["*","-","+","-","+","*"],["*","-","+","-","+","+"],["*","-","+","-","+","-"],["*","-","+","-","-","*"],["*","-","+","-","-","+"],["*","-","+","-","-","-"],["*","-","-","*","*","*"],["*","-","-","*","*","+"],["*","-","-","*","*","-"],["*","-","-","*","+","*"],["*","-","-","*","+","+"],["*","-","-","*","+","-"],["*","-","-","*","-","*"],["*","-","-","*","-","+"],["*","-","-","*","-","-"],["*","-","-","+","*","*"],["*","-","-","+","*","+"],["*","-","-","+","*","-"],["*","-","-","+","+","*"],["*","-","-","+","+","+"],["*","-","-","+","+","-"],["*","-","-","+","-","*"],["*","-","-","+","-","+"],["*","-","-","+","-","-"],["*","-","-","-","*","*"],["*","-","-","-","*","+"],["*","-","-","-","*","-"],["*","-","-","-","+","*"],["*","-","-","-","+","+"],["*","-","-","-","+","-"],["*","-","-","-","-","*"],["*","-","-","-","-","+"],["*","-","-","-","-","-"],["+","*","*","*","*","*"],["+","*","*","*","*","+"],["+","*","*","*","*","-"],["+","*","*","*","+","*"],["+","*","*","*","+","+"],["+","*","*","*","+","-"],["+","*","*","*","-","*"],["+","*","*","*","-","+"],["+","*","*","*","-","-"],["+","*","*","+","*","*"],["+","*","*","+","*","+"],["+","*","*","+","*","-"],["+","*","*","+","+","*"],["+","*","*","+","+","+"],["+","*","*","+","+","-"],["+","*","*","+","-","*"],["+","*","*","+","-","+"],["+","*","*","+","-","-"],["+","*","*","-","*","*"],["+","*","*","-","*","+"],["+","*","*","-","*","-"],["+","*","*","-","+","*"],["+","*","*","-","+","+"],["+","*","*","-","+","-"],["+","*","*","-","-","*"],["+","*","*","-","-","+"],["+","*","*","-","-","-"],["+","*","+","*","*","*"],["+","*","+","*","*","+"],["+","*","+","*","*","-"],["+","*","+","*","+","*"],["+","*","+","*","+","+"],["+","*","+","*","+","-"],["+","*","+","*","-","*"],["+","*","+","*","-","+"],["+","*","+","*","-","-"],["+","*","+","+","*","*"],["+","*","+","+","*","+"],["+","*","+","+","*","-"],["+","*","+","+","+","*"],["+","*","+","+","+","+"],["+","*","+","+","+","-"],["+","*","+","+","-","*"],["+","*","+","+","-","+"],["+","*","+","+","-","-"],["+","*","+","-","*","*"],["+","*","+","-","*","+"],["+","*","+","-","*","-"],["+","*","+","-","+","*"],["+","*","+","-","+","+"],["+","*","+","-","+","-"],["+","*","+","-","-","*"],["+","*","+","-","-","+"],["+","*","+","-","-","-"],["+","*","-","*","*","*"],["+","*","-","*","*","+"],["+","*","-","*","*","-"],["+","*","-","*","+","*"],["+","*","-","*","+","+"],["+","*","-","*","+","-"],["+","*","-","*","-","*"],["+","*","-","*","-","+"],["+","*","-","*","-","-"],["+","*","-","+","*","*"],["+","*","-","+","*","+"],["+","*","-","+","*","-"],["+","*","-","+","+","*"],["+","*","-","+","+","+"],["+","*","-","+","+","-"],["+","*","-","+","-","*"],["+","*","-","+","-","+"],["+","*","-","+","-","-"],["+","*","-","-","*","*"],["+","*","-","-","*","+"],["+","*","-","-","*","-"],["+","*","-","-","+","*"],["+","*","-","-","+","+"],["+","*","-","-","+","-"],["+","*","-","-","-","*"],["+","*","-","-","-","+"],["+","*","-","-","-","-"],["+","+","*","*","*","*"],["+","+","*","*","*","+"],["+","+","*","*","*","-"],["+","+","*","*","+","*"],["+","+","*","*","+","+"],["+","+","*","*","+","-"],["+","+","*","*","-","*"],["+","+","*","*","-","+"],["+","+","*","*","-","-"],["+","+","*","+","*","*"],["+","+","*","+","*","+"],["+","+","*","+","*","-"],["+","+","*","+","+","*"],["+","+","*","+","+","+"],["+","+","*","+","+","-"],["+","+","*","+","-","*"],["+","+","*","+","-","+"],["+","+","*","+","-","-"],["+","+","*","-","*","*"],["+","+","*","-","*","+"],["+","+","*","-","*","-"],["+","+","*","-","+","*"],["+","+","*","-","+","+"],["+","+","*","-","+","-"],["+","+","*","-","-","*"],["+","+","*","-","-","+"],["+","+","*","-","-","-"],["+","+","+","*","*","*"],["+","+","+","*","*","+"],["+","+","+","*","*","-"],["+","+","+","*","+","*"],["+","+","+","*","+","+"],["+","+","+","*","+","-"],["+","+","+","*","-","*"],["+","+","+","*","-","+"],["+","+","+","*","-","-"],["+","+","+","+","*","*"],["+","+","+","+","*","+"],["+","+","+","+","*","-"],["+","+","+","+","+","*"],["+","+","+","+","+","+"],["+","+","+","+","+","-"],["+","+","+","+","-","*"],["+","+","+","+","-","+"],["+","+","+","+","-","-"],["+","+","+","-","*","*"],["+","+","+","-","*","+"],["+","+","+","-","*","-"],["+","+","+","-","+","*"],["+","+","+","-","+","+"],["+","+","+","-","+","-"],["+","+","+","-","-","*"],["+","+","+","-","-","+"],["+","+","+","-","-","-"],["+","+","-","*","*","*"],["+","+","-","*","*","+"],["+","+","-","*","*","-"],["+","+","-","*","+","*"],["+","+","-","*","+","+"],["+","+","-","*","+","-"],["+","+","-","*","-","*"],["+","+","-","*","-","+"],["+","+","-","*","-","-"],["+","+","-","+","*","*"],["+","+","-","+","*","+"],["+","+","-","+","*","-"],["+","+","-","+","+","*"],["+","+","-","+","+","+"],["+","+","-","+","+","-"],["+","+","-","+","-","*"],["+","+","-","+","-","+"],["+","+","-","+","-","-"],["+","+","-","-","*","*"],["+","+","-","-","*","+"],["+","+","-","-","*","-"],["+","+","-","-","+","*"],["+","+","-","-","+","+"],["+","+","-","-","+","-"],["+","+","-","-","-","*"],["+","+","-","-","-","+"],["+","+","-","-","-","-"],["+","-","*","*","*","*"],["+","-","*","*","*","+"],["+","-","*","*","*","-"],["+","-","*","*","+","*"],["+","-","*","*","+","+"],["+","-","*","*","+","-"],["+","-","*","*","-","*"],["+","-","*","*","-","+"],["+","-","*","*","-","-"],["+","-","*","+","*","*"],["+","-","*","+","*","+"],["+","-","*","+","*","-"],["+","-","*","+","+","*"],["+","-","*","+","+","+"],["+","-","*","+","+","-"],["+","-","*","+","-","*"],["+","-","*","+","-","+"],["+","-","*","+","-","-"],["+","-","*","-","*","*"],["+","-","*","-","*","+"],["+","-","*","-","*","-"],["+","-","*","-","+","*"],["+","-","*","-","+","+"],["+","-","*","-","+","-"],["+","-","*","-","-","*"],["+","-","*","-","-","+"],["+","-","*","-","-","-"],["+","-","+","*","*","*"],["+","-","+","*","*","+"],["+","-","+","*","*","-"],["+","-","+","*","+","*"],["+","-","+","*","+","+"],["+","-","+","*","+","-"],["+","-","+","*","-","*"],["+","-","+","*","-","+"],["+","-","+","*","-","-"],["+","-","+","+","*","*"],["+","-","+","+","*","+"],["+","-","+","+","*","-"],["+","-","+","+","+","*"],["+","-","+","+","+","+"],["+","-","+","+","+","-"],["+","-","+","+","-","*"],["+","-","+","+","-","+"],["+","-","+","+","-","-"],["+","-","+","-","*","*"],["+","-","+","-","*","+"],["+","-","+","-","*","-"],["+","-","+","-","+","*"],["+","-","+","-","+","+"],["+","-","+","-","+","-"],["+","-","+","-","-","*"],["+","-","+","-","-","+"],["+","-","+","-","-","-"],["+","-","-","*","*","*"],["+","-","-","*","*","+"],["+","-","-","*","*","-"],["+","-","-","*","+","*"],["+","-","-","*","+","+"],["+","-","-","*","+","-"],["+","-","-","*","-","*"],["+","-","-","*","-","+"],["+","-","-","*","-","-"],["+","-","-","+","*","*"],["+","-","-","+","*","+"],["+","-","-","+","*","-"],["+","-","-","+","+","*"],["+","-","-","+","+","+"],["+","-","-","+","+","-"],["+","-","-","+","-","*"],["+","-","-","+","-","+"],["+","-","-","+","-","-"],["+","-","-","-","*","*"],["+","-","-","-","*","+"],["+","-","-","-","*","-"],["+","-","-","-","+","*"],["+","-","-","-","+","+"],["+","-","-","-","+","-"],["+","-","-","-","-","*"],["+","-","-","-","-","+"],["+","-","-","-","-","-"],["-","*","*","*","*","*"],["-","*","*","*","*","+"],["-","*","*","*","*","-"],["-","*","*","*","+","*"],["-","*","*","*","+","+"],["-","*","*","*","+","-"],["-","*","*","*","-","*"],["-","*","*","*","-","+"],["-","*","*","*","-","-"],["-","*","*","+","*","*"],["-","*","*","+","*","+"],["-","*","*","+","*","-"],["-","*","*","+","+","*"],["-","*","*","+","+","+"],["-","*","*","+","+","-"],["-","*","*","+","-","*"],["-","*","*","+","-","+"],["-","*","*","+","-","-"],["-","*","*","-","*","*"],["-","*","*","-","*","+"],["-","*","*","-","*","-"],["-","*","*","-","+","*"],["-","*","*","-","+","+"],["-","*","*","-","+","-"],["-","*","*","-","-","*"],["-","*","*","-","-","+"],["-","*","*","-","-","-"],["-","*","+","*","*","*"],["-","*","+","*","*","+"],["-","*","+","*","*","-"],["-","*","+","*","+","*"],["-","*","+","*","+","+"],["-","*","+","*","+","-"],["-","*","+","*","-","*"],["-","*","+","*","-","+"],["-","*","+","*","-","-"],["-","*","+","+","*","*"],["-","*","+","+","*","+"],["-","*","+","+","*","-"],["-","*","+","+","+","*"],["-","*","+","+","+","+"],["-","*","+","+","+","-"],["-","*","+","+","-","*"],["-","*","+","+","-","+"],["-","*","+","+","-","-"],["-","*","+","-","*","*"],["-","*","+","-","*","+"],["-","*","+","-","*","-"],["-","*","+","-","+","*"],["-","*","+","-","+","+"],["-","*","+","-","+","-"],["-","*","+","-","-","*"],["-","*","+","-","-","+"],["-","*","+","-","-","-"],["-","*","-","*","*","*"],["-","*","-","*","*","+"],["-","*","-","*","*","-"],["-","*","-","*","+","*"],["-","*","-","*","+","+"],["-","*","-","*","+","-"],["-","*","-","*","-","*"],["-","*","-","*","-","+"],["-","*","-","*","-","-"],["-","*","-","+","*","*"],["-","*","-","+","*","+"],["-","*","-","+","*","-"],["-","*","-","+","+","*"],["-","*","-","+","+","+"],["-","*","-","+","+","-"],["-","*","-","+","-","*"],["-","*","-","+","-","+"],["-","*","-","+","-","-"],["-","*","-","-","*","*"],["-","*","-","-","*","+"],["-","*","-","-","*","-"],["-","*","-","-","+","*"],["-","*","-","-","+","+"],["-","*","-","-","+","-"],["-","*","-","-","-","*"],["-","*","-","-","-","+"],["-","*","-","-","-","-"],["-","+","*","*","*","*"],["-","+","*","*","*","+"],["-","+","*","*","*","-"],["-","+","*","*","+","*"],["-","+","*","*","+","+"],["-","+","*","*","+","-"],["-","+","*","*","-","*"],["-","+","*","*","-","+"],["-","+","*","*","-","-"],["-","+","*","+","*","*"],["-","+","*","+","*","+"],["-","+","*","+","*","-"],["-","+","*","+","+","*"],["-","+","*","+","+","+"],["-","+","*","+","+","-"],["-","+","*","+","-","*"],["-","+","*","+","-","+"],["-","+","*","+","-","-"],["-","+","*","-","*","*"],["-","+","*","-","*","+"],["-","+","*","-","*","-"],["-","+","*","-","+","*"],["-","+","*","-","+","+"],["-","+","*","-","+","-"],["-","+","*","-","-","*"],["-","+","*","-","-","+"],["-","+","*","-","-","-"],["-","+","+","*","*","*"],["-","+","+","*","*","+"],["-","+","+","*","*","-"],["-","+","+","*","+","*"],["-","+","+","*","+","+"],["-","+","+","*","+","-"],["-","+","+","*","-","*"],["-","+","+","*","-","+"],["-","+","+","*","-","-"],["-","+","+","+","*","*"],["-","+","+","+","*","+"],["-","+","+","+","*","-"],["-","+","+","+","+","*"],["-","+","+","+","+","+"],["-","+","+","+","+","-"],["-","+","+","+","-","*"],["-","+","+","+","-","+"],["-","+","+","+","-","-"],["-","+","+","-","*","*"],["-","+","+","-","*","+"],["-","+","+","-","*","-"],["-","+","+","-","+","*"],["-","+","+","-","+","+"],["-","+","+","-","+","-"],["-","+","+","-","-","*"],["-","+","+","-","-","+"],["-","+","+","-","-","-"],["-","+","-","*","*","*"],["-","+","-","*","*","+"],["-","+","-","*","*","-"],["-","+","-","*","+","*"],["-","+","-","*","+","+"],["-","+","-","*","+","-"],["-","+","-","*","-","*"],["-","+","-","*","-","+"],["-","+","-","*","-","-"],["-","+","-","+","*","*"],["-","+","-","+","*","+"],["-","+","-","+","*","-"],["-","+","-","+","+","*"],["-","+","-","+","+","+"],["-","+","-","+","+","-"],["-","+","-","+","-","*"],["-","+","-","+","-","+"],["-","+","-","+","-","-"],["-","+","-","-","*","*"],["-","+","-","-","*","+"],["-","+","-","-","*","-"],["-","+","-","-","+","*"],["-","+","-","-","+","+"],["-","+","-","-","+","-"],["-","+","-","-","-","*"],["-","+","-","-","-","+"],["-","+","-","-","-","-"],["-","-","*","*","*","*"],["-","-","*","*","*","+"],["-","-","*","*","*","-"],["-","-","*","*","+","*"],["-","-","*","*","+","+"],["-","-","*","*","+","-"],["-","-","*","*","-","*"],["-","-","*","*","-","+"],["-","-","*","*","-","-"],["-","-","*","+","*","*"],["-","-","*","+","*","+"],["-","-","*","+","*","-"],["-","-","*","+","+","*"],["-","-","*","+","+","+"],["-","-","*","+","+","-"],["-","-","*","+","-","*"],["-","-","*","+","-","+"],["-","-","*","+","-","-"],["-","-","*","-","*","*"],["-","-","*","-","*","+"],["-","-","*","-","*","-"],["-","-","*","-","+","*"],["-","-","*","-","+","+"],["-","-","*","-","+","-"],["-","-","*","-","-","*"],["-","-","*","-","-","+"],["-","-","*","-","-","-"],["-","-","+","*","*","*"],["-","-","+","*","*","+"],["-","-","+","*","*","-"],["-","-","+","*","+","*"],["-","-","+","*","+","+"],["-","-","+","*","+","-"],["-","-","+","*","-","*"],["-","-","+","*","-","+"],["-","-","+","*","-","-"],["-","-","+","+","*","*"],["-","-","+","+","*","+"],["-","-","+","+","*","-"],["-","-","+","+","+","*"],["-","-","+","+","+","+"],["-","-","+","+","+","-"],["-","-","+","+","-","*"],["-","-","+","+","-","+"],["-","-","+","+","-","-"],["-","-","+","-","*","*"],["-","-","+","-","*","+"],["-","-","+","-","*","-"],["-","-","+","-","+","*"],["-","-","+","-","+","+"],["-","-","+","-","+","-"],["-","-","+","-","-","*"],["-","-","+","-","-","+"],["-","-","+","-","-","-"],["-","-","-","*","*","*"],["-","-","-","*","*","+"],["-","-","-","*","*","-"],["-","-","-","*","+","*"],["-","-","-","*","+","+"],["-","-","-","*","+","-"],["-","-","-","*","-","*"],["-","-","-","*","-","+"],["-","-","-","*","-","-"],["-","-","-","+","*","*"],["-","-","-","+","*","+"],["-","-","-","+","*","-"],["-","-","-","+","+","*"],["-","-","-","+","+","+"],["-","-","-","+","+","-"],["-","-","-","+","-","*"],["-","-","-","+","-","+"],["-","-","-","+","-","-"],["-","-","-","-","*","*"],["-","-","-","-","*","+"],["-","-","-","-","*","-"],["-","-","-","-","+","*"],["-","-","-","-","+","+"],["-","-","-","-","+","-"],["-","-","-","-","-","*"],["-","-","-","-","-","+"],["-","-","-","-","-","-"]]]]