by@n4o847
AC
695ms
/T/{t=index($0,"T");s=$0}/K/{for(s=substr($0,1,t);sub(/K /,"KK",s););}$0=s
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 KKKK