by@_primenumber
AC
758ms
a,*b,c=*$<;puts a,b.map{a},(c.rstrip+?a*99)[0..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 T Kaaaaaaaaaaaaaaaaa