# Help me do my washing

Help! My Completely Automated Lights From Darks Separator V3001.01 broke! :(

# Guidelines

Write a program that will take an input of an array (or a list in some languages) of any amount of strings that are either the letter L or the letter D (representing lights or darks) and output an array that contains two arrays, one with all the L's, and one with all the D's.

## Rules

• It's code golf so the shortest answer in bytes wins
• Input will only ever contain capitals
• There must be the same number of L's in the output as there is in the input, same goes for the D's
• The input may only have one element (or maybe even zero elements)
• If one or both of the output arrays contain no elements, output an empty list (in some languages this may mean you need to output a string)
• Always have the first array be the array of L's

## Example output:

["L","D","L","D","D"] -> [["L","L"],["D","D","D"]]

["L","L","L"] -> [["L","L","L"],[]]

["D","D"] -> [[],["D","D"]]

[] -> [[],[]]

• Can we input/output as a string? For example: "LDLDD" -> "LL DDD" or something like that? – Comrade SparklePony Jul 11 '17 at 4:54
• Or output perhaps as a list of the two strings, e.g. "LDLDD" -> ["LL", "DDD"] – Comrade SparklePony Jul 11 '17 at 7:27
• Would also like an answer, as my answer depends on this – Skidsdev Jul 11 '17 at 8:46
• How about mixed output? As in an array containing one string and one array of strings? e.g., ["L","L",["D","D","D"]]. – Shaggy Jul 11 '17 at 8:59
• No, the output must be an array/list. @ComradeSparklePony – aimorris Jul 11 '17 at 9:04

# J, 13 bytes

<@-."1 0&'DL'


Try it online!

## Javascript, 38 bytes

q=>['L','D'].map(x=>q.filter(y=>x==y))

• Hello and welcome to the site! We do not allow answers that assume a variable as input, we call these snippets. Instead format your answer as a function (named on unnamed), or a full program with IO. – Ad Hoc Garf Hunter Oct 2 '17 at 6:47
• Thanks @FunkyComputerMan. I edited it, let me know if it is correct. – Coert Grobbelaar Oct 2 '17 at 11:10

# Retina, 21 11 bytes

-10 bytes thanks to CalculatorFeline

O^.
LD
L D


Try it online!

• The 21 byte version can be O^. LD L D. – CalculatorFeline Jul 12 '17 at 3:02

# Ruby, 20 bytes

->l{[l-[?D],l-[?L]]}
`

Try it online!