Your task is, to count how many pluses I have.
What Pluses?
- The no plus: 0 Points
-
- The naïve Plus: 1 Point
+
- The double Plus: 2 Points
+
+++
+
- The mega double plus: 3 Points
+
+++
+
+ + +
+++++++++
+ + +
+
+++
+
Pluses of higher order than 3 must be ignored.
Rules
- Input will only consist of two characters - and +, and it will always be rectangular.
- Input can be a string, an array or a binary matrix (then + is 1 and - is 0).
- Output must be the sum of all detected pluses (trailing newline/ whitespace allowed).
- Pluses can overlap (see Examples below)
- Default I/O rules apply
- Default Loop holes apply
Examples
-+-
+-+
+--
Out: 4
-+-
+++
+++
Out: 9 (7 naïve pluses and 1 double plus)
++++++
++++++
++++++
++++++
Out: 40 (24 naïve pluses and 8 double pluses)
----+-----
+--+++----
----++----
-+--+--++-
+++++++++-
-+--+--++-
----+-+---
---+++----
+---++++++
Out: 49 (36 naïve pluses, 5 double pluses and 1 mega double plus)
++++++++++
++++++++++
++++++++++
++++++++++
++++++++++
++++++++++
++++++++++
++++++++++
++++++++++
Out: 208 (90 naïve pluses, 56 double pluses and 2 mega double plus)