fork download
  1. f=lambda s:[a*s.count(a)for a in{*s}-{' '}]
  2.  
  3. print(f('Ah, abracadabra!'))
  4. # -> ['rr', 'bb', ',', 'c', 'A', 'h', 'aaaaa', 'd', '!']
  5.  
  6. print(f('\\o/\\o/\\o/'))
  7. # -> ['///', 'ooo', '\\\\\\']
  8. # (the extra backslashes are to escape a single backslash)
  9.  
  10. print(f('A man, a plan, a canal: Panama!'))
  11. # -> ['aaaaaaaaa', 'p', 'P', 'nnnn', 'mm', ':', 'A', 'c', ',,', 'll', '!']
  12.  
  13. print(f('"Show me how you do that trick, the one that makes me scream" she said'))
  14. # -> ['tttttt', 'hhhhhh', 'u', 'ooooo', ',', 'cc', 'kk', 'eeeeeee', 'ii', 'aaaaa',
  15. # 'rr', 'dd', 'n', 'ssss', 'mmmm', 'ww', '""', 'y', 'S']
Compilation error #stdin compilation error #stdout 0.01s 9992KB
stdin
Standard input is empty
compilation info
Traceback (most recent call last):
  File "/usr/lib/python3.4/py_compile.py", line 124, in compile
    _optimize=optimize)
  File "<frozen importlib._bootstrap>", line 1532, in source_to_code
  File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
  File "./prog.py", line 1
    f=lambda s:[a*s.count(a)for a in{*s}-{' '}]
                                     ^
SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.4/py_compile.py", line 128, in compile
    raise py_exc
py_compile.PyCompileError:   File "./prog.py", line 1
    f=lambda s:[a*s.count(a)for a in{*s}-{' '}]
                                     ^
SyntaxError: invalid syntax

stdout
Standard output is empty