Skip to main content
3 of 3
Commonmark migration

Ruby, 56 bytes

Ported from @Dennis answer.

->a,s{s.chars.sort_by{|c|a.index(3-c.ord/32).to_s+c}*''} 

An alternate 58 bytes solution that I like better, inspired by @Neil and modified slightly from his answer.

->a,s{a.map{|i|s.scan([/[a-z]/,/[A-Z]/,/\d/][i]).sort}*''} 

Try either version online! (commented-out version is the alternate solution)

Value Ink
  • 13.5k
  • 1
  • 18
  • 46