fork download
  1. f=@(x)mat2cell(y=strtrim(sort(x)),1,diff(find([1 diff(+y) 1])))
  2.  
  3. f('Ah, abracadabra!')
  4. f('\o/\o/\o/')
  5. f('A man, a plan, a canal: Panama!')
  6. f('"Show me how you do that trick, the one that makes me scream" she said')
Success #stdin #stdout 0.22s 121792KB
stdin
Standard input is empty
stdout
f =

@(x) mat2cell (y = strtrim (sort (x)), 1, diff (find ([1, diff(+y), 1])))

ans = 
{
  [1,1] = !
  [1,2] = ,
  [1,3] = A
  [1,4] = aaaaa
  [1,5] = bb
  [1,6] = c
  [1,7] = d
  [1,8] = h
  [1,9] = rr
}
ans = 
{
  [1,1] = ///
  [1,2] = \\\
  [1,3] = ooo
}
ans = 
{
  [1,1] = !
  [1,2] = ,,
  [1,3] = :
  [1,4] = A
  [1,5] = P
  [1,6] = aaaaaaaaa
  [1,7] = c
  [1,8] = ll
  [1,9] = mm
  [1,10] = nnnn
  [1,11] = p
}
ans = 
{
  [1,1] = ""
  [1,2] = ,
  [1,3] = S
  [1,4] = aaaaa
  [1,5] = cc
  [1,6] = dd
  [1,7] = eeeeeee
  [1,8] = hhhhhh
  [1,9] = ii
  [1,10] = kk
  [1,11] = mmmm
  [1,12] = n
  [1,13] = ooooo
  [1,14] = rr
  [1,15] = ssss
  [1,16] = tttttt
  [1,17] = u
  [1,18] = ww
  [1,19] = y
}