(1) Determine the amount of statues
05AB1E, 15 bytes
„-|v€Åγ˜y¢Iø}Š+
Try it online!
Commented:
„-| # push string literal "-|"
v } # iterate over this string
€Åγ # run-length encode each line of the input / transposed input
# this pushes the chunk elements and the chunk lengths
˜ # flatten the list
y¢ # count the chunks of the current character
Iø # push the transposed input to the stack for the second iteration
Š # triple-swap: move the transposed input to bottom
+ # sum both counts
Ruby, 93 86 61 58 bytes
Saved seven bytes, thanks to Razetime!
Saved three bytes, thanks to ovs!
->s{((s.transpose*"").scan(/\|+/)+(s*"").scan(/-+/)).size}
Try it online!
Takes input as a matrix of characters.
Retina 0.8.2, 37 bytes
-+|(?<=(.)*)¦(?!.*¶(?<-1>.)*(?(1)$)¦)
Try it online! Uses ¦
instead of |
. Explanation:
-+|
Count runs of -
s, or...
(?<=(.)*)¦(?!.*¶(?<-1>.)*(?(1)$)¦)
... any ¦
s which do not have a ¦
directly underneath them on the next line. This uses a .NET balancing group to ensure that the two ¦
s are vertically aligned.