Help me do my washing
Python 3, 37 bytes
lambda a:[[c]*a.count(c)for c in"LD"]
Try it online!
APL, 8 bytes
'DL'~⍨¨⊂
Explanation:
⊂
: enclosed input~⍨¨
: without each'DL'
: 'D' and 'L'
Examples:
('DL'~⍨¨⊂) 'LDLDD'
┌──┬───┐
│LL│DDD│
└──┴───┘
('DL'~⍨¨⊂) 'LLL'
┌───┬┐
│LLL││
└───┴┘
('DL'~⍨¨⊂) 'DD'
┌┬──┐
││DD│
└┴──┘
('DL'~⍨¨⊂) ''
┌┬┐
│││
└┴┘
Haskell, 28 bytes
f l=[filter(==[c])l|c<-"LD"]
Try it online!
If the input can be a list of characters, the []
around c
can be removed.