[Question]
  [
Lighthouses on an island have blink codes that let ships know which lighthouse they are seeing. Input should be strings of S and L. Here is a (Python) example of codes for 4 lighthouses as a list of strings:
```
['SLS', 'SLL', 'SSS', 'LSL']
```
where:
S = short ON (1 sec)  
L = long ON (3 sec)
Long and short ON's are both followed by 1 sec OFF, except the last in the code, which is followed by a *7-second LONG OFF pause* to signify end of code. The code for the first lighthouse in the above example corresponds to this blink *schedule* in seconds :
1 ON, 1 OFF, 3 ON, 1 OFF, 1 ON, 7 OFF [repeat]
**Challenge:**
n Lighthouses come on simultaneously, each at the start of its schedule. Write a program that takes a series of blink codes (strings in the above format) and outputs the total number of seconds that *exactly* zero, one, two, three, ... n lighthouses were on at the same time *after the first hour of lighthouse operation* (So the output numbers will always total 3600.)
**Test Cases**:
```
Input -> Output
['SLS', 'SLL', 'SSS', 'LSL'] -> 1125, 890, 652, 590, 343  
['S', 'L', 'SS'] -> 2250, 630, 540, 180 
['SLSL', 'S'] -> 1850, 1450, 300  
['SLS'] -> 2314, 1286  
['SS', 'SS', 'L'] -> 2520, 360, 0, 720
```
**Rules**:
There can be one or more lighthouses (code strings).
All lighthouses come on simultaneously, each at the start of its code schedule.
Codes can be any length >= 1 and don't have to be unique (however off-shore mayhem may ensue).
Just for clarity, the 652 in the first example is the time in seconds that *exactly* 2 lighthouse (not 2 or more) were on.
The shortest code in bytes wins ([code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'")).
  
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~24 22 21~~ 20 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
O%9ÄṬ;Øỵ¬ṁ⁽½c)SċⱮLŻ$
```
A monadic Link that accepts the list of lists of `S` and/or `L` characters and yields the ascending list of multiplicity counts.
**[Try it online!](https://tio.run/##y0rNyan8/99f1fJwy8Oda6wPz3i4e@uhNQ93Nj5q3Htob7Jm8JHuRxvX@RzdrfL///9o9WCfYHUdBSDlA6aCwTyfYB/1WAA "Jelly – Try It Online")** Or see the [test-suite](https://tio.run/##y0rNyan8/99f1fJwy8Oda6wPz3i4e@uhNQ93Nj5q3Htob7Jm8JHuRxvX@RzdrfL/cPujpjX//0dHqwf7BKvrKAApHzAVDOb5BPuox3LpAGXBPIgMVAQkB@LDuVBGMFQVWENsLAA "Jelly – Try It Online").
### How?
```
O%9ÄṬ;Øỵ¬ṁ⁽½c)SċⱮLŻ$ - Link: lighthouse patterns, P
             )       - for each pattern in P: say, 'SLSL'
O                    -   cast to ordnials     [83,76,83,76]
 %9                  -   modulo nine          [2,4,2,4]
   Ä                 -   cumulative sums      [2,6,8,12]
    Ṭ                -   untruth              [0,1,0,0,0,1,0,1,0,0,0,1]
     ;Øỵ             -   concatenate "aeiouy" [0,1,0,0,0,1,0,1,0,0,0,1,'a','e','i','o','u','y']
        ¬            -   logical NOT          [1,0,1,1,1,0,1,0,1,1,1,0,0,0,0,0,0,0]
                                              (the "full-pattern" of this lighthouse)
          ⁽½c        -   3600
         ṁ           -   (full-pattern) moulded-like (3600) -> above repeated to length 3600
              S      - sum (vectorises) -> counts at each second
                   $ - last two links as a monad, f(P):
                 L   -   length of P
                  Ż  -   zero-range -> [0..length(P)]
                Ɱ    - for each n in [0..length(P)]:
               ċ     -   count occurrences of n in the counts at each second
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 25 bytes
```
ε€C9%Å10.ý˜7Å0«60n∍}øOZÝ¢
```
[Try it online!](https://tio.run/##yy9OTMpM/f//3NZHTWucLVUPtxoa6B3ee3qO@eFWg0OrzQzyHnX01h7e4R91eO6hRf//RysF@wQr6SgAKR8wFQzm@QT7KMUCAA "05AB1E – Try It Online")
```
ε                  }        # for each lighthouse in the implicit input:
 €C                         #   convert each character from binary
   9%                       #   modulo 9: S -> 28 %9 = 1, L -> 21%9 = 3
     Å1                     #   for each number in the resulting list get a list of that many 1's
       0.ý                  #   intersperse with 0's 
          ˜                 #   flatten into a list of 1's and 0's
           7Å0«             #   append 7 0's
               60n∍         #   extend the list to length 60^2=3600 by cycling the values
                    ø       # after the loop: transpose the list of lists
                     O      # sum every one of the 3600 sublists
                      ZÝ    # get the range [0 .. max(a)]
                        ¢   # for each value in the range, count occurences in the long list
```
Try the `S/L` to `0/1` conversion with step-by-step output: [Try it online!](https://tio.run/##NcxPasJQEAbwfU4xBCQWRJ4LEQsuiigE3OUEz2ZiHiQz4b3x37YgdNMb9AYt9ATdNEtv4UWio3Qxm/l938fBrh12XZxSs5XneBDNojiaM@3QCxSea0jWjqw/JoqXt@@5BmrOtxXDVH/T3r3i0QpC5YIE4AJGSVBsTyPVlAR9aG6HsHdSgnmwaX@G7a8mlpUVQQIpHyOq50@Vl6ZBymHy35m0J/P3pbI4iIowVEib2@rYQP@1tLTBHAr2kGPNFMRbcUxPWh6by/vHrOuyVXYF "05AB1E – Try It Online")
[Answer]
# [J](http://jsoftware.com/), 60 53 52 bytes
```
_1+(0,#\)#/.~@,[:+/(3600$(6$0),~&;19<@#:@|14+3&u:)&>
```
[Try it online!](https://tio.run/##dY5LC8IwEITv/RWLlbahsd08rfFBQfCUkzkqWBBFvHjyJv71ukGrJyEZlsw3s7n2oyo/w9JBDhwQHN1JBeut3/QHURbI0z1L6@rZ8p0r60JZxHFhx8j4M5uL2aJNXfsQulTZ3bFs1bPkdLzc4AzBhy5434UQOh/8@7kQQhoOzQw5WCM5mDgprYDBxP1NSWliQJEYTSIaHPguskN5EzGhoyrEXyUxQ5MSmhDZ2I/L3SInIh98I2PYktCZym8JfYt2Jf0L "J – Try It Online")
-7 after reading Jonathan Allen's idea of doing arithmetic on the character codes, though I use a different method which converts S to 2 and L to 14, and then converts those to binary.
## idea
* For each pattern, convert it into a bitmask where 1 is on, 0 is off
* Extend that bitmask cyclically to 3600. Now we have an `n x 3600` matrix.
* Sum columns. Now we have the numbers 0-n, each some number of times.
* Prepend the numbers 0-n to that list, in case any happen to be missing, and so the result will be ordered from 0 to n.
* Group and count.
* Subtract 1 from each count.
[Answer]
# JavaScript (ES6), 113 bytes
Expects an array of strings. Returns an object.
```
a=>(n=3600,g=L=>n--?g(o[a.map(s=>t+=~~(s=s.replace(/./g,c=>c>g?10:1110))[n%(s.length+6)],t=0),t]=-~o[t]):o)(o={})
```
[Try it online!](https://tio.run/##bY/NboQgFEb3fQo2jZBB5UccOwnOC7hzaVwQx6GdWDAj6aapr25Bm7TpSMh3L4tzLvemPtTU3d9GFxt76ZerXJQsoZE8JwRrWcnSxPFZQ9uo5F2NcJKlO8h59s2U3PtxUF0P0yTVuJNlV@ozJSdKKUGoMc9wSobeaPd6yFGLnSQIu1bGs21ci04WQSs/v9DSWTPZoU8Gq@EVNlFd1REGvlRrqddXVVdRixAAaQooZQKD4oVgkAuGgQgdzzgATw@uld08G//3eBdjImi4D5H5oAXZsYTpwfGo2Cy0CBaaheSEgF3FLvz7EU4zr2BFvkfXPyus2/z3BFqwMDr34e@RkeUb "JavaScript (Node.js) – Try It Online")
[Answer]
# Python 2, ~~125~~ 117 bytes
```
lambda a:map(map(sum,zip(*[sum([2*(c<'S')*[1]+[1,0]for c in C],[0]*6)*500for C in a]))[6:3606].count,range(len(a)+1))
```
-8 thanks to Jonathan Allan.
[Answer]
# [Python 3](https://docs.python.org/3/), 154 bytes
Very trivial approach: convert the code strings into sequences of 1s and 0s representing the seconds in which each lighthouse is ON or OFF; then cumulate the sum of seconds depending on how many lighthouses are on at the same time.
```
def f(h):
 t=[0]*(len(h)+1)
 for i in range(3600):t[[c[i]for c in[(x.replace('S','10').replace('L','1110')+'0'*6)*450for x in h]].count('1')]+=1
 print(t)
```
[Try it online!](https://tio.run/##TYxBDoMgEEX3noLdMNoYiK0LE2/AjiVhYShUE4PG0MSe3gJtbFcz/72Zv77CuPjmOO7WEUdH7AoSesV0SWfrY644FsQtG5nI5Mk2@IelTcsYdkEpoyadnIlO0b3e7DoPxlKQcAHOAH9EJMITq4BB2WJ5vbH0u6feUevaLE8fKHBAXfW8IOs2xRzwcFSBFLGSxCHykDkJKUBjkX3OH3ey5BP5A@cqv7f5TePxBg "Python 3 – Try It Online")
---
*Un-golfed function with comments*
```
def f(lighthouses):
    """
    function that takes as input the list of lighthouses' blink codes
    """
    # replace in the codes 'S' and 'L' with '1's
    # corresponding to the effective ON duration in seconds
    # '0' is needed for the OFF separation period
    lighthouses = [x.replace('S', '10') for x in lighthouses]
    lighthouses = [x.replace('L', '1110') for x in lighthouses]
    # LONG OFF period
    # only 6s because one '0' is already added on the last character
    lighthouses = [x + '0'*6 for x in lighthouses]
    # repeat the sequence for at least 1h
    # minimum code duration 'S' = 8s
    # 3600/8=450 then repeat 450 times to be sure to have at least 1h
    lighthouses = [x * 450 for x in lighthouses]
    # initialize the list to keep the total number of seconds
    tot = [0] * (len(lighthouses) + 1)
    
    # loop over 1h of repeated sequences
    for i in range(3600):
    
        # increase the counter
        # the index corresponds to how many lighthouses are ON at the same time
        # counting how many '1's there are at a given position in all the sequences
        tot[[c[i] for c in lighthouses].count('1')] += 1
    
    # outputs the list with total seconds
    print(tot)
```
[Answer]
# [R](https://www.r-project.org/), ~~119~~ 116 bytes
*Edit: -3 bytes thanks to Giuseppe*
```
function(a)table(c(rowSums(sapply(a,function(x)!1:3600%in%cumsum(rep(c(utf8ToInt(x)%%9,!!1:6),999)))),0:sum(a>0)))-1
```
[Try it online!](https://tio.run/##fc49C8MgEAbgv9IMEgULhkKogXYvuNldjDVUiBr8IO2vT68ZOvaWlxeeOy5tofrRJhUnla2J4ZHV6spTBTW7ctmmGkxxMWBNih5niw1OcZXVZ5z1ssxvrOnPvEjTDaeeMeQCMmCqx8kusFPLdL7HWyhgEOK0AdgTyjknMJQNX6qvDMqx@/sSHGulkC09QIg95N6EFC0h2wc "R – Try It Online")
[Answer]
# [Nibbles](http://golfscript.com/nibbles/index.html), 24 bytes
```
.:0,,$,`?.`'.@<3600^~:+.$.\`,%$9`$$.,6 0+$@
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m708LzMpKSe1eMGCpaUlaboWN7X1rAx0dFR0Euz1EtT1HGyMzQwM4uqstPVU9GISdFRVLBNUVPR0zBQMtFUcIFpgOjWilaJjlIJ9gmOUdBRADB8oIxgq4hMMFIlVioVqAAA)
This program is a bit complicated.
```
.:0,,$,`?.`'.@<3600^~:+.$.\`,%$9`$$.,6 0+$@
.                                           For each
 :0,                                         n from 0 to
    ,                                         length
     $                                         input
      ,`?                                    number of occurences
                                          @   of n in
         .                              +$     sum each sublist of
          `'                                    transpose
            .                                    for each
             @                                    blink code from the input
              <3600                               take the first 3600 items of
                   ^~                              repeat infinitely
                     :                              join
                      +                              concatenate
                       .                              for each
                        $                              letter from the blink code
                         .      `$$                     sign of each number in
                          \                              reversed
                           `,                             range from 0 up to (excluding)
                             %$9                           the letter modulo 9
                                   .,6 0             with six zeroes
```
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), `AB` 37 bytes
```
:ƛ`SL`⟨₀|1110⟩Ŀ\06εJṅÞċ60²Ẏv⌊;∑$Lʀ¨VO
```
The first start may be slow (or time-off) due to the use of the infinite lazy list, but then everything works well
[Try it Online!](https://vyxal.pythonanywhere.com/#WyJBQiIsIiIsIjrGm2BTTGDin6jigoB8MTExMOKfqcS/XFwwNs61SuG5hcOexIs2MMKy4bqOduKMijviiJEkTMqAwqhWTyIsIiIsIlsnU0xTJywgJ1NMTCcsICdTU1MnLCAnTFNMJ11cblsnUycsICdMJywgJ1NTJ11cblsnU0xTTCcsICdTJ11cblsnU0xTJ10gXG5bJ1NTJywgJ1NTJywgJ0wnXSJd)
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 32 bytes
```
ＩＥ⊕Ｌθ№Ｅ³⁶⁰⁰Σ⭆θ§⁺⪫Ｅν×1∨⁼πS³0×0⁷λι
```
[Try it online!](https://tio.run/##LYzLCoMwEEV/JWTjCCmkCO2iqyJdWFIqpDtxETRoII6PxNK/T43t6szcOXObXi3NqGwI5WLQQ66ch4eaoMBm0YNGr1sQGjvfw5ymjOTjij8jO3HOiFwHkH777WI2M3L1Bbb6A6VdHdxHg7uMjLzMoB3QI2XkucBtXpV1MDFCJd16szS2Ux7nv8k38xxTm@5HE3EJoaoSKWTCyAaxQ@6bkCKp63B42y8 "Charcoal – Try It Online") Link is to verbose version of code. Explanation: For each number of "on" lighthouses and each second of the hour, calculate the "on" pattern for each lighthouse and count how many of the seconds had that number of lighthouses "on".
```
    θ                               Input array
   Ｌ                                Length
  ⊕                                 Incremented
 Ｅ                                  Map over implicit range
       ³⁶⁰⁰                         Literal `3600` (seconds)
      Ｅ                             Map over implicit range
             θ                      Input array
            ⭆                       Map over elements and join
                  ν                 Current blink code
                 Ｅ                  Map over characters
                    1               Literal string `1`
                   ×                Repeated by
                       π            Current character
                      ⁼             Equals
                        S           Literal string `S`
                     ∨              Logical Or
                         ³          Literal `3`
                ⪫                   Join with
                          0         Literal string `0`
               ⁺                    Concatenated with
                            0       Literal string `0`
                           ×        Repeated by
                             ⁷      Literal `7`
              §                     Indexed by
                              λ     Current second
           Σ                        Sum i.e. count of "on" lighthouses
     №                              Count of
                               ι    Outer index
Ｉ                                   Cast to string
                                    Implicitly print
```
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 119 bytes
```
Rest@BinCounts@Total[PadRight[#,3600,#]&/@(Flatten@Join[Characters[#]/.{"S"->{1,0},"L"->{1,1,1,0}},Array[0#&,6]]&/@#)]&
```
[Try it online!](https://tio.run/##TUy9CsIwGNx9CkmgKEQbEdyUaMFBMpTGLWT4qMUE2hTSz0FKnr32Z5Eb7o77aQBt1QC6EgZ7HoqqQ3FzPms/HjvxbBFqncOrcG@LmrLjiXNGTZKKzb0GxMqLR@u8ziwEKLEKnaYm3fdEkd2lPzAeGZGLnMBjZNcQ4Ks5TdjJTEd0a5IhD86jsGIcSkXYeiQ5k5qdVJLE1V9p6SwZicMP "Wolfram Language (Mathematica) – Try It Online")
Seems similar to others (yet DIY and worse), but I couldn’t get past the challenge with the word "Lighthouse" 8)
]