by@shell_mug
AC
791ms
NR==1{sub("T(.+)","T");t=$0}NR>1{print t}END{sub("K(.+)","K");while(length($0)<length(t)){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 T T T T T T T T T T T T T T T T T T T KKKKKKKKKKKKKKKKKKKKKKKKKKKKKK