[Question]
  [
Given a string containing only the characters `-`, `|`, `+` and newline determine the longest straight line contained in it. A straight line is either an uninterupted run of `-`s and `+`s in a single row or an uninterupted run of `|`s and `+`s in a single column.
So for example:
```
    |      
    |  ----
    |      
  --+--    
    |      
    |      
```
There are 3 lines here one vertical, two horizontal, with the vertical line being the longest since it is 6 characters.
Your challenge is to write a program or function which takes a string as input and gives the length of the longest line.
You may assume that the input is perfectly rectangular. That is that every row has the same number of characters. You may also assume that the input contains at least 1 of the non-whitespace characters (`-`, `|`, and `+`).
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), answers will be scored in bytes with fewer bytes being the goal.
## Test cases
```
    |      
    |  ----
    |      
  --+--    
    |      
    |      
```
6
```
           
    +      
           
           
```
1
```
 ---|---
    |
    |
    |
```
4
```
-     
-|||||
-     
```
1
```
   |  
   |  
      
+----+
```
6
```
 |+-
-+| 
```
2
```
   |    
   |    
   |    
   |  + 
      | 
   |  | 
   |    
   |  | 
        
+-+     
```
4
  
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~19~~ ~~13~~ 12 bytes
```
OZ%3;ƲḂŒgẎ§Ṁ
```
[Try it online!](https://tio.run/##y0rNyan8/98/StXY@timhzuajk5Kf7ir79Dyhzsb/j/cveXhjq6HO6cdbtf8/19dXZ1LAQhqFMAAxtYFAjRxXV1tXV1kNRhsoFk6CjADFZAUaCOxFbCwERqB1tYgW42FAVesC9GsWwMCMB6yG2og2mrgtnFpg/yljaSoRluXS1e7BqwPAA "Jelly – Try It Online")
Takes input as a list of lines/a character matrix
~~First attempt, can probably be improved by a lot.~~ Ports [wasif's Vyxal answer](https://codegolf.stackexchange.com/a/235802/66833) for the conversion to `1`/`0` matrices, so make sure you drop them an upvote as well.
-1 byte thanks to [Jonathan Allan](https://codegolf.stackexchange.com/users/53748/jonathan-allan)!
## How it works
```
OZ%3;ƲḂŒgẎ§Ṁ - Main link. Takes a matrix M on the left
O            - Convert each character to an ordinal
     Ʋ       - Last 4 links as a monad f(ord(M)):
 Z           -   Transpose
  %3         -   Mod by 3 (|,+ -> 1, space -> 2, - -> 0)
    ;        -   Concatenate to ord(M)
      Ḃ      - Mod each 2 (1 -> 1, 45, 43 -> 1, 32, 124, 2, 0 -> 0) 
       Œg    - Over each list, group adjacent equal elements
         Ẏ   - Drop into a list of lists
          §  - Sums of each (lists of 0 -> 0, lists of 1 -> length)
           Ṁ - Maximum
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 9 bytes
```
ø3%«É€γOZ
```
[Try it online!](https://tio.run/##yy9OTMpM/f//8A5j1UOrD3c@alpzbrN/1P//0dHGRjoKyNjQyARVAIFjdRTwKzcxRcYEleM2HW6IMYJNolsoUx7LBQA "05AB1E – Try It Online")
-2 thanks to @ovs
Takes charcode matrix
This takes inspiration from Arnauld answer:
* Modulo input matrix by 2 (Or is odd number) to get horizontal lines. (Run of 1)
* Take the input matrix again and transpose (to get the columns) then Modulo by 3 are odd numbers? (Vertical runs)
* Pair them, for each
* Group consecutive equals
* Sum them up
* Take the maximum
And that's the result
[Answer]
# JavaScript (ES10), 88 bytes
Expects a matrix of ASCII codes.
```
m=>Math.max(...m.map(r=>r.map(H=(v,x)=>[m.map(V=r=>V=r[x]%3%2*-~V),H=v%2*-~H])).flat(3))
```
[Try it online!](https://tio.run/##bY/LTsMwEEX3@QqrUVUPqS1El8iREAJlw6pSN2kWlus0QXnhmCgIw68Hx2lpEL0L68zMnYdfecdbofJGk6o@yCFlQ8nCF64zWvIeU0pLCw1WLFQOIoa7dQ8sjKfCjtmSfeI@WW6WdzfkewfriHUOowSApgXXeAMwKPn2niuJV2m7AqokPzznhdx@VALfAtX1Vqu8OmKgbVPkGi/2le/7@2phR9TqiYsMt4iF6NNDqEQMtReftbgjx3Jsb1aJi8UYCyoyrh7t5x40BoB72y7qqq0LSYv6iFNcjskvGJCVQU7eiYmV9zdPSEDI3POP7dUeushxMGN0hV2PXWbmC6/A6CNTCzGjztFpqZnM5ne8F4x/CKa6CYhHAoN@AA "JavaScript (Node.js) – Try It Online")
### How?
Given an ASCII code \$v\$, we use \$v\bmod 2\$ and \$(v\bmod 3)\bmod 2\$ to identify horizontal and vertical characters respectively.
```
 char. | code | % 2 | % 3 % 2
-------+------+-----+---------
  ' '  |  32  |  0  |    0
  '+'  |  43  |  1  |    1
  '-'  |  45  |  1  |    0
  '|'  | 124  |  0  |    1
```
### Commented
```
m =>                       // m[] = input matrix
Math.max(...               // return the maximum of all values
  m.map(r =>               //   for each row r[] in m[]:
    r.map(H =              //     initialize H to a non-numeric value
    (v, x) =>              //     for each value v at position x in r[]:
      [ m.map(V =          //       initialize V to a non-numeric value
        r =>               //       for each row r[] in m[]:
          V = r[x] % 3 % 2 //         increment V if r[x] is '|' or '+'
              * -~V        //         otherwise, clear V
        ),                 //       end of map()
        H = v % 2          //       increment H if v is '-' or '+'
            * -~H          //       otherwise, clear H
      ]                    //
    )                      //     end of map()
  )                        //   end of map()
  .flat(3)                 //   deep flatten
)                          // end of Math.max()
```
[Answer]
# [Dyalog APL](https://www.dyalog.com/), ~~31~~ 27 bytes
```
{≢⍉↑↑⊆⍨¨(↓⍵∊'-+'),↓⍉⍵∊'|+'}
```
-4 thanks to [ovs](https://codegolf.stackexchange.com/users/64121/ovs).
[Try it online!](https://tio.run/##fU9BCsIwELz7ir1FWResSvE7paIIBYWexHgtthBQ/IGnPkA/4FP2I3WTRk1VHAKbDDM7k2ST0XybZOslpVmS56u0aRZcHHdcXtiUXJzsqQo29b3uc3Fmc@NDpQjVYOiepWc0qr14AWKIIjZXBQINL8iVBB2WCFvmW2uherJuGqwLgPAH3ggzZ5RU/ZEcTieeSG8rbtuQtqDOrtiX0N2yaD@FTjQWnRNpIVE7ZzR6tvgd7ieGlH5PCN8@r9WqBw)
Expects a matrix of characters.
```
          ⍵∊'-+'            Turn - and + into 1s and other characters into 0s
         ↓                  and split the matrix into individual rows.
                    ⍵∊'|+'  Take the original matrix, turn | and + into 1s,
                   ⍉        transpose it,
                  ↓         and again split it into rows.
                 ,          Join the rows together.
     ⊆⍨¨                    Extract streaks of 1s for each row.
   ↑↑                       Reduce the level of nesting twice to obtain a
                            3-dimensional array where the 1-streaks, padded
                            with 0s at the end, lie along the last dimension.
 ≢⍉                         Finally, get the length of this dimension,
                            i.e., the length of the longest 1-streak.
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), ~~17~~ 16 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
…-+|ü2Iδå`ø«€γOà
```
Input as a matrix of characters.
Port of [*@cairdCoinheringaahing*'s Jelly answer](https://codegolf.stackexchange.com/a/235790/52210), so make sure to upvote him as well.
[Try it online](https://tio.run/##yy9OTMpM/f//UcMyXe2aw3uMPM9tObw04fCOQ6sfNa05t9n/8IL//6OjlRSUdFBwDRofgWN1FPAr10XBBJXjMR1mijYSm0THUKY8FgA) or [verify all test cases](https://tio.run/##yy9OTMpM/V@m5JlXUFpipaBkX3lo26GFj5rWBNuGVupwKfmXlkAl/j9qWKarXXN4j1HEuS2HlyYc3nFoNVDduc3@hxf81zm0zf5/tJICENQogEFMHpSjCwRwDkxGV1dbVxdFGQZHSUdBSQEBIHLayBwFLBywLqCNNSi2YmOBVOpCDdCtAQEgjWxzDVR1DcKKmDxtkHe0lWIB).
**Explanation:**
```
…-+|              # Push string "-+|"
    ü2            # Create overlapping pairs of this string: ["-+","+|"]
       δ          # Map over this pair of strings:
      I å         #  Check for each character in the input-matrix if it's in this string
         `        # After the map: pop and push both matrices separated to the stack
          ø       # Zip/transpose the top one; swapping rows/columns
           «      # Merge the lists together
            €γ    # Split each inner list into groups of the same digits
              O   # Sum each inner-most list
               à  # And take the flattened maximum of these sums
                  # (after which it is output implicitly as result)
```
[Answer]
# [Java (JDK)](http://jdk.java.net/), ~~192~~ ~~175~~ ~~169~~ 167 bytes
```
n->{int i,r,l=0,b,h[]=new int[n[0].length];for(var a:n)for(r=i=0;i<a.length;i++){l=(r=(b=a[i])==45|b==43?r+1:0)>l?r:l;l=(h[i]=b>45|b==43?h[i]+1:0)>l?h[i]:l;}return l;}
```
[Try it online!](https://tio.run/##rVPBcoIwEL37FTueYCCItr1Io9PpyUNPHhkOASLExsCEYMdRv50mFtDpdGptm0PY7L6XvH3DrsmWoHX62iScVBW8ECZgPxiAXqMRJDkRGSUxp8CEonJFEnqq9SdYaDi0S2dB0UqBpYkyjMJIp8pa2cEJcvy4t6xjzhKoFFH6sy1YChvzrLVUkolMk4jMKruT0UqpqKrLPrGAquC1YoUA3CfP6KzgK5pCUqS0EWi2N8KYK12OfTd28zDCgr4ZuaEI/cjjVGQqj4JVIa0tkUCmwjaxxAz7AXskLSJgjmPvOdYFK8YkZJGN8f3DIdb73Vw646lvz/hcTnmgQbmu43jW1825g5hYo45SdyUF6KgJBud@e/uMmwtj4RjwhdGf19Bshzb2VPGs@U9Skp1lu1dJCBC6mXTrSwg5CP1K3v@TjsF3Tk@@dHpo5CPnqpDhDwUPP3T@GXfZy3JXKbrxilp5pZ4kxYXVTYln2rPOf5PdjuRttImhdaN8bN4B "Java (JDK) – Try It Online")
-6 thanks to Kevin Cruijssen; -2 thanks to Celingcat!
[Answer]
# [R](https://www.r-project.org/), ~~87~~ 86 bytes
Or **[R](https://www.r-project.org/)>=4.1, 72 bytes** by replacing two `function` appearances with `\`s.
*-1 byte thanks to [@Dominic van Essen](https://codegolf.stackexchange.com/users/95126/dominic-van-essen).*
```
function(s,b=function(x,r=rle(x))max(r$l[r$v==1]))max(apply(s%%2,1,b),apply(s%%3,2,b))
```
[Try it online!](https://tio.run/##pVFBCoMwELznFSIKG9wcrKX0kgf07q3tQUsFIY2SxGIhf7exFrEo0tI5zSxLZnaiuoJ3RSMvpqwkaMz5KFpUXIkrtJTeshZUII4quHMen4dBVtfiAToMNxhjTnHUCW6cpl0Bt8yosoVGilIbEMPGVYA2SteiNEB8z8F6L5A3Zw7kc85YxNh0Z8Z99E/SpxQbU@zT6iCN4zvElFLydRBv8nA04d6cL/ptf/FzV9rppQvkbxM25Ga2B2ErVSW/VWWHmHYshUT9t0Vrkbsn "R – Try It Online")
That turned out shorter than I expected.
Takes input as matrix of character codes.
### Explanation
```
function(s,     # function takes s as input
 b=function(x,  # helper function for rows/columns
  r=rle(x))     # compute run length encoding
   max(         # get maximum
    r$l[r$v==1] # of run lengths where value is one
   ))
max(            # maximum of
 apply(         # apply to
  s%%2,         # the matrix with ones for | and +
  1,b),         # the helper function along columns
 apply(         # apply to
  s%%3,         # the matrix with ones for - and +
  2,b)          # the helper function along rows
)
```
[Answer]
# [GolfScript](http://www.golfscript.com/golfscript/), 52 bytes
```
n/.zip]"-":a;{{{.a"+"+\?-1>*}%"ø"%{,}/}/"|":a;}%$-1=
```
[Try it online!](https://tio.run/##S8/PSStOLsosKPn/P09fryqzIFZJV8kq0bq6ulovUUlbSTvGXtfQTqtWVYlBSbVap1a/Vl@pBqSgVlVF19D2/38FIKhRAAMuKFsXArhQpXR1tXV1kZWhswE "GolfScript – Try It Online")
Explanation:
```
n/.             split input on newline
  .zip          duplicate and zip(transpose rows and columns) the copy
      ]         put them in an array
"-":a; has "-"  for first copy and "|" for the zipped copy
{               map over the copies of input
 {              for each line
  {             map over each char
   .a"+"+\?-1>* returns char if == a ("-" or "|") or "+", otherwise 0
  }%
  "ø"%          splits on ø(null char, "\x00") to get array of lines
  {,}/          for each, get length
 }/
 "|":a;         sets a to "|" for the next copy
}%
                left with array of line lengths
$-1=            sort and get last element, aka get max
                implicit print
```
There is probably some completely different approach that is smaller, but I am pretty happy with how small I got this.
The difference between `{...}~`(map) and `{...}/`(for each) is that map returns an array, while for each dumps them on the stack, essentially `{...}~~`. Rearranging and using `/` allowed me to save a few chars I didn't think I could, so that's pretty cool.
The code has a literal null char that stackoverflow isn't liking, so I replaced it with `ø`. The tio.run link should work.
[Answer]
# [C++ (gcc)](https://gcc.gnu.org/), 124 bytes
```
int f(char*a){char*b=a,*c=a,l=0,h=0;for(;*a;++a)*a%2?l=l>++h?l:h:h=0,*a>10?*a%5>2?*a=0,l=l>++*c?l:*c:*c=0,++c:c=b;return l;}
```
[Try it online!](https://tio.run/##hZNRj4IwDMff@RSNl0tgdQmiaMIEP8h5D3PgQTLRID45Pzu34ckNxdAQ1na/tn@WIU4n@iNE0xRlDXtX5Lwi3Lu26y7mUyL0S8b@NI99tj9WLiOcIXKP8M9gI2OZIOYbGeWRBqaEJzN/o7fCJNCLztwJIjRChH50ClFEIt6xKqsvVQmS3ZqPohTykmawLo7nusr4IXEco@jAi9L14OoAGEkgZl/fEMNkqxMAClrbll1ItVnh/y6lSOkTPBBOWDcpsCdBn8Z@CIOh1Wve9dL6lK3x1bHKFo8y2vWnyljrPQ8JLcGqU6NsXcZDc0Zo1S27OoWtMIrK7rvq97U7v/PRmqmsvHrDq97Z3VXi4/t0/lynUSSOlxrWa3NLZ55x2mxWppINIME4Mh9HFuNIOI4sx5HVK/L3f/jMuTW/ "C++ (gcc) – Try It Online")
This is my first time submitting a code here, so I'm open to any improvements. I don't think I used anything past `C++98`. The function takes a C-string as input and modifies it.
### Explanation
```
int f(char* a) {              // Take a C-string as input
  char* b = a;                // Preserve a pointer to the beginning
  char* c = a;                // Use the first row of a to keep track of
                              // vertical line lengths; this is tracked by c.
  char l = 0;                 // Maximal line length
  char h = 0;                 // Current horizontal line length
  
  for (; *a; ++a) {           // *a may be '\0' (0), '\n' (10), ' ' (32),
                              // '+' (43), '-' (45), or '|' (124).
    if (*a % 2) {             // Current character is '+' (43) or '-' (45)
      ++h;                    // Increment current horizontal line length
      l = l > h ? l : h;      // Update maximal line length
    }
    else {
      h = 0;                  // Reset horizontal line length
    }
    
    if (*a != 10) {
      if (*a % 5 > 2) {       // Current character is '+' (43) or '|' (124)
        *a = 0;               // Set current character to 0 (only needed
                              // for the first row)
        ++*c;                 // Increment current column's vertical line
                              // length
        l = l > *c ? l : *c;  // Update maximal line length
      }
      else {
        *c = 0;               // Reset current column's vertical line length
      }
      ++c;
    }
    else {                    // Current character is '\n' (10)
      c = b;                  // Reset column tracker
    }
  }
  return l;
}
```
[Answer]
# [Python 3](https://docs.python.org/3/), ~~114~~ 109 bytes
*-5 bytes thanx to Alex Waygood*
```
lambda i,j=''.join:max(map(len,g('[-+]+',i)+g('[|+]+',j(map(j,zip(*i.split('\n')))))))
import re
g=re.findall
```
[Try it online!](https://tio.run/##dY/NDsIgEITvPAXpBZRuL95M@iTWA6Y/LgFKkIMa3r3S1pja6pxmyezHrHuEa28PQ1tWg5bmUkuKuSoZK1SP9mjknRvpuG5s3nF2AnEWLMedGIc4DWoKqPyJju@xuDmNgbPKst0sgsb1PlDfkK70TdGiraXWg/NoA295lmU0KdJJ5O0hiXy/AwiAZWbtEyl9R1ZgugiKhadb/wOQasRlla3ZLsEMhjiKwP9uccbETwsixrvFFB5e "Python 3 – Try It Online")
[Answer]
# [Retina](https://github.com/m-ender/retina/wiki/The-Language), 74 bytes
```
Lw$`([-+]+)|[|+]((?<=(.)*.).*¶(?<-3>.)*(?(3)^)[|+])*
$1¶_$#2*
%C`.
N^`
0G`
```
[Try it online!](https://tio.run/##K0otycxLNPz/36dcJUEjWlc7VluzJrpGO1ZDw97GVkNPU0tPU0/r0DYgT9fYDsjVsNcw1ozTBCnR1OJSMTy0LV5F2UiLS9U5QY/LLy6By8A94f9/XQUFhRog1gUyuBQgHF0gAHNqQDIgAOToamvraoPluRR0QVQNWAFMD5gDAA "Retina – Try It Online") Explanation:
```
Lw`([-+]+)|[|+]((?<=(.)*.).*¶(?<-3>.)*(?(3)^)[|+])*
```
List all overlapping matches of either horizontal or vertical lines. A .NET balancing group is used to ensure that all of the characters in the vertical line are in the same column. All overlapping matches are needed to ensure that all possible lines are detected, as simple overlaps would only detect the horizontal line of an upside-down `L` shape.
```
L$`
$1¶_$#2*
```
For each match list the horizontal line and a string of underscores of the length of the vertical line. (There is always at least one underscore even when there was no vertical match but the horizontal match is always at least length `1` in this case anyway.)
```
%C`.
```
Count the number of characters in each line.
```
N^`
```
Sort in descending order.
```
0G`
```
Take the maximum.
[Answer]
## [Nibbles](http://golfscript.com/nibbles), 12 bytes
```
`/+.:$`'!$ 3%.%~$%$~,$]
```
That's 23 nibbles which are encoded in 0.5 bytes each. Nibbles isn't on TIO yet.
Translation:
```
`/        special fold
  +       concat
   .      map \a ->
    :     concat
     $    input
     `'   transpose
       !  special zip
        $ input
        3
        % mod
    . map \b ->
     %~   split by \c ->
       $  a
       %  mod
        $ c
        ~ 2
     ,$   length b
 ]        max
```
Usage: pass the input in via the command line as a list of strings. You could use stdin instead but then instead of a $ you'd need ;;@ for the stdin as lines.
```
nibbles longestline.nbl "[\"-+ \",\" | ]\"]"
```
This is inspired by the 05ab1e solution, although surprisingly longer.
[Answer]
# [Pip](https://github.com/dloscutoff/pip), 26 bytes
```
MX#*:(J*ZgR'-sALgR'|s)Jn^w
```
[Try it online!](https://tio.run/##K8gs@P/fN0JZy0rDSysqPUhdt9jRB0jVFGt65cWV//@voKurWwPEXApAUINM/tctAgA "Pip – Try It Online") (Uses the `-r` flag to take input as lines of stdin, but would also work without the flag if input lines were given as command-line arguments.)
### Explanation
```
MX#*:(J*ZgR'-sALgR'|s)Jn^w
                            g is lines of input; s is space; n is newline; w is
                            regex matching runs of whitespace (implicit)
         gR'-s              In g, replace all hyphens with spaces
        Z                   Zip (transpose rows for columns)
      J*                    Join each column into a string
              AL            To the list of columns, append this list:
                gR'|s       In g, replace all pipes with spaces
     (               )Jn    Join the resulting list on newlines
                        ^w  Split on runs of whitespace
  #*:                       Get the length of each run of non-whitespace characters
MX                          Take the maximum
```
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal) `G`, 14 bytes
```
∷¹ǒ∷ÞT"ƛ0ZfĠv∑
```
[Try it Online!](https://lyxal.pythonanywhere.com?flags=G&code=%E2%88%B7%C2%B9%C7%92%E2%88%B7%C3%9ET%22%C6%9B0Zf%C4%A0v%E2%88%91&inputs=&header=&footer=)
-7 thanks to @AaronMiller and @emanresuA
[Answer]
# [Ruby](https://www.ruby-lang.org/), 103 bytes
```
->m{eval"(m#{e=".map{|x|x+[' ']}.join.gsub('"}|',' ')+m.transpose#{e}-',' ')).split.map(&:length).max"}
```
[Try it online!](https://tio.run/##fU9Ra4MwGHz/fsVHWpaE7AusjD0M3B8pY9gZuxa10sTiMP52l2hxroXdSy7H3eVybnbfwzpPBnorO3NJCybKVWcSpsu07nzrW7XlyN97fTwdKr23zU5w1nv@GFSpSu3OaWXrkzUh1dMkS23r4uBihXh4LUy1d18y3FrWD5nJ0RnrhJWAH5sME7STXXDgcn520pDzHrBunMV1rj/TohBjSAKYKgOITcgwwOMIuHIKgL86kSJaem45g9ULLDtx4VELjv/z0PM014QdfrnlngT78/wsTW3kI4Du@8YM/B7RreJv1TT/avOKgJSP2Q3cDhx@AA "Ruby – Try It Online")
* takes a 2d array as input.
We use eval to repeat `e` two times by interpolation.  
`e`= adds a column of spaces, joins and calls gsub..  
to swap `|` or `-` with a space, we do it on both input and input transposed.  
Then we split to get our desired chunks of lines and we get the max length
[Answer]
# [Perl 5](https://www.perl.org/), 94 bytes
```
sub{$s=$_=pop;max((map y///c,/[-+]+/g),map{map$c=/[|+]/?$c+1:0,$s=~/^.{0,$_}(.?)/mg}0..y///c)}
```
[Try it online!](https://tio.run/##bVJdT8IwFH3vr2hI4z66rmDUh41mPuiTCi/6BEhwjGWRsYXWBLKOP@Grv84f4my3IYjepO29555z2tw0j9bLywotWMXfXgrEGZqyPMv9dLYxzXSWwy2lNHToiOAJprHlKKxQC4WMjiSe0ACFuOd1HSXd0We3UNm0NN3Aomlcdl231ltl5adbiETEBWf9vnE7uDF8AKAKCevY50TFCU4IJuSY8ycHV40XrnfQU5WykT9Wv3ZwAQBpdETq2Fe1rjY9OnQD60fh5haJCSBYKvb5P@zDgVuxbGt50pcHc1w/SY0ELLK1HvqImq4dWOZ4ji3KJ047tx1V6HhOY24VtTrdmog7KNrkFrtGU78FIYozwc7QQnWtBszXyUpAzWRMdwMje/38eDc8w7btwfARDu@MI2YHagdNhEoShSKaMy0erzo@KKuvLBdJtuIVebhPuPC8J5Esmfoy3w "Perl 5 – Try It Online")
[Answer]
## [Wolfram](https://www.wolfram.com/language/), 98 bytes
```
Max[Length/@Flatten[Map[r|->SequenceCases[r,{#2..}],#]&@@@{{#,"-"|"+"},{Transpose@#,"|"|"+"}},2]]&
```
Explanation
```
Max[                                                    Max of
  Length /@ Flatten[                                    Length of
    Map[r |->                                             For each row
        SequenceCases[r, {#2 ..}], #] &                     Sequences of
     @@@ {{#, "-" | "+"}, {Transpose@#, "|" | "+"}},          - or + in the input
                                                              | or + in the transpose of the input
    2]] &
```
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 35 bytes
```
ＷＳ⊞υιＩＬ⌈⁺Ｅυ⌈⪪⭆ι№-+λ0Ｅ§υ⁰⌈⪪⭆υ№|+§λκ0
```
[Try it online!](https://tio.run/##dYzBCoMwDIbvPkXw1NIWvHsanoQNBJ@gOLFltcpsNw99966x6G0/hOTPn3yDku9hkSbGr9JmBNLa1bvevbWdCKXQ@U0Rz0HTuujS0pFGbo7cRzs5RR5y17OfSWf8lsyKl@euX412JJMw0hyaxSdAKVjJwVDKoaxKbBjfXGuf446Eiv6n@IsSkHJ@GQ4vehGz6hgFAIRUIg0FZCOSDhMwQSUjGBPsyAsQ2MJxcP5kE8XH/AA "Charcoal – Try It Online") Link is to verbose version of code. Takes input as a list of newline-terminated strings. Explanation:
```
ＷＳ⊞υι
```
Input the strings into an array.
```
ＩＬ⌈⁺
```
Output the length of the maximum line in either of the following:
```
Ｅυ⌈⪪⭆ι№-+λ0
```
For each string in the array, replace each character with `1` if it is `-` or `+` otherwise `0`, then split the result on `0`s and take the maximum string of `1`s. This results in a list of strings that have the lengths of the longest line in each row.
```
Ｅ§υ⁰⌈⪪⭆υ№|+§λκ0
```
For each column, build up a string of `1`s and `0`s corresponding to whether each character is `|` or `+` or not, then split on `0`s and take the maximum again, resulting in a list of strings that have the lengths of the longest line in each column.
[Answer]
# Scala, 92 bytes
```
l=>(l.flatMap(_ split "[ |]")++l.transpose.flatMap(_.mkString split "[ -]")).map(_.size).max
```
[Try it in Scastie!](https://scastie.scala-lang.org/HkWtbCXmRpiEMORfYB1AcA)
Takes a `Seq[String]`.
## Slightly longer solution, 94 bytes
```
l=>(for((m,c)<-Seq(l->"[ |]",l.transpose->"[ -]");r<-m;p<-r.mkString split c)yield p.size).max
```
[Try it in Scastie!](https://scastie.scala-lang.org/SzZOYbpIRwmcpdZzSRfquQ)
Takes input as a `Seq[Seq[Char]]`.
[Answer]
# [Japt](https://github.com/ETHproductions/japt) [`-h`](https://codegolf.meta.stackexchange.com/a/14339/), 19 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
```
"-|"¬c@zY ôkXi+ÃmÊn
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&flags=LWg&code=Ii18IqxjQHpZIPRrWGkrw23Kbg&input=IiAgICB8ICAgICAgCiAgICB8ICAtLS0tCiAgICB8ICAgICAgCiAgLS0rLS0gICAgCiAgICB8ICAgICAgCiAgICB8ICAgIg)
```
"-|"¬c@zY ôkXi+ÃmÊn     :Implicit input of string U
"-|"¬                   :Split "-|" into an array of characters
     c                  :Flat map
      @                 :By passing each X at 0-based index Y through the following function
       zY               :  Rotate U 90 degrees Y times
          ô             :  Split at characters that return truthy (non-empty string)
           k            :  When the following characters are removed
            Xi+         :    "+" prepended to X
               Ã        :End map
                m       :Map
                 Ê      :  Length
                  n     :Sort
                        :Implicit output of last element
```
]