by@k_hanazuki
AC
889ms
say $!=get;say m|K|??S[K]='K'x$!.index('T')-$/.from+1!!$! for lines T
K
T
T
T
T
T
T
T
T
KKKKKKKKKKKKKK