by@akouryy1
AC
860ms
a,*b,c=*$<;puts a,b.map{a};puts' '*(g=c=~/K/)+?a*(1-g+(a=~/T/))
T K
T T T T T T T T T T T T T T T T T T T T T T T T aaaaaaaaaaaaaaaaaaaaaaaaaa