Skip to main content
1 of 2
Asone Tuhid
  • 2.4k
  • 8
  • 22

Ruby, 73 bytes

->s,n{(1..n).flat_map{|i|[*s.chars.repeated_permutation(i)]}.map(&:join)}

Try it online!

Asone Tuhid
  • 2.4k
  • 8
  • 22