Skip to main content
5 of 6
deleted 2 characters in body
DavidC
  • 25.4k
  • 2
  • 52
  • 105

#Mathematica 89 bytes

r@i_:=StringReplace[i,#->" "]&/@(Complement[y,#]&/@Subsequences[y=Characters@i])//Column

 

Explanation

i refers to the input string

Subsequences[y=Characters@i] returns all subsequences (represented lists of characters) of the input. (Subsequences was introduced in v. 10.4)

For each subsequence, Complement... returns those characters from the input string that are not present. Each of those characters is replaced by an empty space via StringReplace[i,#->" "].

Column displays the results in a single column. Each output string has the same number of characters, resulting in aligned letters.


r@"abcdefgh"

output

DavidC
  • 25.4k
  • 2
  • 52
  • 105