by@akouryy1
WA
907ms
a=gets;puts a until gets[?K];$_[a=~/T/]=?A;0while$_.sub!'K ','KK';print
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 T T T KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKA