Python 3.5+, 77 46 4444 41 bytes
lambda s:[a*s.count(a)for a in set(s){*s}-{' '}]
Pretty simple. Goes through the unique characters in the string by converting it to a set (using Python 3.5's extended iterable unpacking), then uses a list comprehension to construct the exploded diagrams by counting the number of times each character occurs in the string with str.count
. We filter out spaces by removing them from the set.
The order of the output may vary from run to run; sets are unordered, so the order in which their items are processed, and thus this answer outputs, cannot be guaranteed.
This is a lambda expression; to use it, prefix lambda
with f=
.
Try it on Ideone! (Now with all test cases!)Try it on Ideone! Ideone uses Python 3.4, which isn't sufficient.
Usage example:
>>> f=lambda s:[a*s.count(a)for a in set(s){*s}-{' '}]
>>> f('Ah, abracadabra!')
[',', 'A', 'aaaaa', 'd', '!', 'bb', 'h', 'c', 'rr']
Saved 3 bytes thanks to @shooqie!